Kodlama İle İlgili Bir Soru
-
bu aralar forex robotlarına kafayı takmış durumdayım mql dili c# diline yakın benim yaptımak istediğim bir analiz var bir türlü becermedim
resimdeki olayı kodmasını nasıl yapabilirm
yeşil ve turuncu eşitse aç 100 pip karda kapat
fakat sorun şurda başlıyor
yeşil ve turuncu eşit 100 pip kar etti ve kapattı ikinci işleme birdahaki kesişme noktasında açmasını istiyorum
eğer ikinci işlemi birinci kesişme noktasından açarza sürekli zarar ediyorumrobtun içeriği şöyle
//------------------------------------------------------------- // Etasoft Inc. Forex EA and Script Generator version 6.0 EA //------------------------------------------------------------- // Keywords: MT4, Forex EA builder, create EA, expert advisor developer #property copyright "Copyright © 2014-2015, Etasoft Inc. Forex EA Generator v6.0" #property link "http://www.forexgenerator.com/" #include <stdlib.mqh> #include <WinUser32.mqh> // exported variables extern double BuyLots8 = 0.1; extern int BuyStoploss8 = 999; extern int BuyTakeprofit8 = 30; // local variables double PipValue=1; // this variable is here to support 5-digit brokers bool Terminated = false; string LF = "\n"; // use this in custom or utility blocks where you need line feeds int NDigits = 4; // used mostly for NormalizeDouble in Flex type blocks int ObjCount = 0; // count of all objects created on the chart, allows creation of objects with unique names int current = 0; // current bar index, used by Cross Up, Cross Down and many other blocks int varylots[101]; // used by Buy Order Varying, Sell Order Varying and similar int init() { NDigits = Digits; if (false) ObjectsDeleteAll(); // clear the chart Comment(""); // clear the chart return (0); } // Expert start int start() { if (Bars < 10) { Comment("Not enough bars"); return (0); } if (Terminated == true) { Comment("EA Terminated."); return (0); } OnEveryTick5(); return (0); } void OnEveryTick5() { PipValue = 1; if (NDigits == 3 || NDigits == 5) PipValue = 10; IfOrderDoesNotExist7(); } void IfOrderDoesNotExist7() { bool exists = false; for (int i=OrdersTotal()-1; i >= 0; i--) if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 1) { exists = true; } } else { Print("OrderSelect() error - ", ErrorDescription(GetLastError())); } if (exists == false) { TechnicalAnalysis6(); } } void TechnicalAnalysis6() { if (iAlligator(NULL, PERIOD_CURRENT,60,8,8,5,5,3,MODE_SMA,PRICE_CLOSE,MODE_GATORJAW,current) == iAlligator(NULL, PERIOD_CURRENT,60,8,8,5,5,3,MODE_SMA,PRICE_CLOSE,MODE_GATORJAW,current)) { BuyOrder8(); } } void BuyOrder8() { double SL = Ask - BuyStoploss8*PipValue*Point; if (BuyStoploss8 == 0) SL = 0; double TP = Ask + BuyTakeprofit8*PipValue*Point; if (BuyTakeprofit8 == 0) TP = 0; int ticket = -1; if (true) ticket = OrderSend(Symbol(), OP_BUY, BuyLots8, Ask, 4, 0, 0, "My Expert", 1, 0, Blue); else ticket = OrderSend(Symbol(), OP_BUY, BuyLots8, Ask, 4, SL, TP, "My Expert", 1, 0, Blue); if (ticket > -1) { if (true) { bool sel = OrderSelect(ticket, SELECT_BY_TICKET); bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue); if (ret == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } } else { Print("OrderSend() error - ", ErrorDescription(GetLastError())); } } int deinit() { if (false) ObjectsDeleteAll(); return (0); }