Нет, брат, извини.
Не мой уровень.
есть более интересные входы по свечным анализам
<code>//+------------------------------------------------------------------+ void CloseTicket(int tic,int type) { if(!OrderSelect(tic, SELECT_BY_TICKET)) Print("OrderSelect() вернул ошибку - ",GetLastError()); else { if(type==OP_BUY) if(!OrderClose(tic,OrderLots(),NormalizeDouble(Bid,Digits),Slippage)) Print("Order Close Buy вернул ошибку - ",GetLastError()); if(type==OP_SELL) if(!OrderClose(tic,OrderLots(),NormalizeDouble(Ask,Digits),Slippage)) Print("Order Close Sell вернул ошибку - ",GetLastError()); } } //+------------------------------------------------------------------+ //| Закрытие всех ордеров по типу | //+------------------------------------------------------------------+ void CloseAllType(int ot) { bool cl; for(int i=OrdersTotal()-1; i>=0; i--) if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber) { if(OrderType()==OP_BUY && ot==OP_BUY) { RefreshRates(); cl=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,Digits),Slippage); } if(OrderType()==OP_SELL && ot==OP_SELL) { RefreshRates(); cl=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,Digits),Slippage); } } } //+------------------------------------------------------------------+ double NL(double lot) // нормализация лота { double LotStep=MarketInfo(Symbol(), MODE_LOTSTEP); int k=0; if (LotStep<=0.001) k=3; else if (LotStep<=0.01) k=2; else if (LotStep<=0.1) k=1; // шаг лота double MinLot=MarketInfo(Symbol(), MODE_MINLOT); double MaxLot=MarketInfo(Symbol(), MODE_MAXLOT); return ND(MathMin(MaxLot, MathMax(MinLot, lot)), k); // венули нормализованный лот } //+------------------------------------------------------------------+ double ND(double d, int n=-1) { if (n<0) return NormalizeDouble(d, Digits); return NormalizeDouble(d, n); } //+------------------------------------------------------------------+ bool CloseAll() { for(int i=OrdersTotal()-1;i>=0;i--) if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderMagicNumber()==MagicNumber) if(OrderSymbol()==Symbol()) { if(OrderType()==OP_BUY) if(!OrderClose(OrderTicket(),OrderLots(),Bid,Slippage)) Sleep(500); if(OrderType()==OP_SELL) if(!OrderClose(OrderTicket(),OrderLots(),Ask,Slippage)) Sleep(500); } return true; } //+------------------------------------------------------------------+ bool BU() { for(int i=OrdersTotal()-1;i>=0;i--) if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderMagicNumber()==MagicNumber) if(OrderSymbol()==Symbol()) { double sl = 0; tp = OrderTakeProfit(); op = OrderOpenPrice(); lt = OrderLots(); double _lt = NormalizeDouble(lt/2,2); if(OrderType()==OP_BUY && Bid >= op+LevelBU*Point) { sl = NSL(OP_BUY,op); if(sl == OrderStopLoss())continue; if(OrderModify(OrderTicket(),op,sl,0,0,clrNONE)) if(!OrderClose(OrderTicket(),_lt,Bid,Slippage)) Sleep(500); } //--- if(OrderType()==OP_SELL && Ask <= op-LevelBU*Point) { sl = NSL(OP_SELL,op); if(sl == OrderStopLoss())continue; if(OrderModify(OrderTicket(),op,sl,0,0,clrNONE)) if(!OrderClose(OrderTicket(),_lt,Ask,Slippage)) Sleep(500); } } return true; } //************************************************************************************************ double NSL(int dir, double oop) // Нормализация цены стоплоса { double SL = LevelBU; if (SL==0) return 0; double StopLvl=MarketInfo(Symbol(), MODE_STOPLEVEL)*Point; double _pr=NP((dir==OP_BUY)?Bid:Ask); if (dir==OP_BUY) { double _sl=oop-SL*Point; return NP(MathMin(_sl, _pr-StopLvl)); } if (dir==OP_SELL) { double _sl=oop+SL*Point; return NP(MathMax(_sl, _pr+StopLvl)); } return 0; } //+------------------------------------------------------------------+ double NP(double d) { double TickSize=MarketInfo(Symbol(), MODE_TICKSIZE); if (TickSize==0) TickSize=1; return ND(MathRound(d/TickSize)*TickSize); } //+------------------------------------------------------------------+ </code</code>
<code>//+------------------------------------------------------------------+ //| Arifmetik_KAE.mq4 | //| Copyright 2022, KAE | //| https://www.forexsystems.biz | //+------------------------------------------------------------------+ #property copyright "Copyright 2022, KAE" #property link "https://www.forexsystems.biz" #property strict input double Risk = 0; // Risk (in %) на сделку в процентах от свободной маржи. Ели "0", то StartLot input double StartLots = 0.02; // Start lot input double LotK = 2.1; // K Lot Коэффициент увеличения лота input int OrderStep = 168; // Order step (in pips) input int MinProfit = 21; // Minimal profit (in pips) for close Average orders input int MaxCountOrders = 22; // Count Orders максимальное число ордеров в рынке. input double LevelStopLoss = 0; // Level Loss (in $). input double LevelStopProfit = 0; // Level Profit (in $). input int LevelBU = 0; // Level BU (in pips). //--- input int MagicNumber = 1961; // Magic Number input int Slippage = 30; // Slippage (in pips) //--- double op,lt,tp,pr; int tk,b,s; double StoimPunkta, MinTP; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { StoimPunkta = MarketInfo(Symbol(),MODE_TICKVALUE) / ( MarketInfo(Symbol(),MODE_TICKSIZE) / MarketInfo(Symbol(),MODE_POINT) ); MinTP = StoimPunkta*MinProfit; // В деньгах // Print("MinProfit за один пункт при lot=1.00, ",+MinTP); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { double StartLot=StartLots; if(Risk>0) StartLot = AccountFreeMargin()/100*Risk/MarketInfo(Symbol(), MODE_MARGINREQUIRED); StartLot = NL(StartLot); if(OrdersTotal()==0) { tk=OrderSend(NULL,OP_BUY, StartLot,ND(Ask),Slippage,0,0,"",MagicNumber); if(tk<0) return; else tk=OrderSend(NULL,OP_SELL,StartLot,ND(Bid),Slippage,0,0,"",MagicNumber); } double BuyPriceMax=0,SelPriceMin=0,BuyPriceMaxLot=0,SelPriceMinLot=0; int BuyPriceMaxTic=0,SelPriceMinTic=0; double BuyLotsSum=0,SelLotsSum=0,WeighBuy=0, WeighSell=0,BuyAllProfit=0,SelAllProfit=0, BuyMaxPriceProfit=0,SelMinPriceProfit=0; b=0;s=0;pr=0; for(int i=OrdersTotal()-1;i>=0;i--) if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderMagicNumber()==MagicNumber) if(OrderSymbol()==Symbol()) { op=NormalizeDouble(OrderOpenPrice(),Digits()); lt=NormalizeDouble(OrderLots(),2); tk=OrderTicket(); pr=OrderProfit()+OrderCommission()+OrderSwap(); if(OrderType()==OP_BUY) { b++; BuyAllProfit += pr+OrderCommission()+OrderSwap(); if(op>BuyPriceMax || BuyPriceMax==0) { BuyPriceMax = op; BuyPriceMaxLot = lt; BuyPriceMaxTic = tk; BuyMaxPriceProfit = pr; } } // === if(OrderType()==OP_SELL) { s++; SelAllProfit += pr+OrderCommission()+OrderSwap(); if(op<SelPriceMin || SelPriceMin==0) { SelPriceMin = op; SelPriceMinLot = lt; SelPriceMinTic = tk; SelMinPriceProfit = pr; } } } double AllProfit = BuyAllProfit + SelAllProfit; //----------------------------------------------------------------------------------- if(Ask>=BuyPriceMax + OrderStep*Point && s+b<MaxCountOrders-1) { if(BuyAllProfit + SelMinPriceProfit >= MinTP*SelPriceMinLot && SelMinPriceProfit!=0) { CloseAllType(OP_BUY); CloseTicket(SelPriceMinTic,OP_SELL); tk=OrderSend(NULL,OP_BUY, StartLot,NormalizeDouble(Ask,_Digits),Slippage,0,0,"",MagicNumber); if(tk<0) return; else tk=OrderSend(NULL,OP_SELL,NL(MathCeil(StartLot*100*LotK)/100),NormalizeDouble(Bid,_Digits),Slippage,0,0,"",MagicNumber); } else { tk=OrderSend(NULL,OP_BUY, StartLot,NormalizeDouble(Ask,_Digits),Slippage,0,0,"",MagicNumber); if(tk<0) return; else tk=OrderSend(NULL,OP_SELL,StartLot,NormalizeDouble(Bid,_Digits),Slippage,0,0,"",MagicNumber); } } //--- if(Bid<=SelPriceMin - OrderStep*Point && s+b<MaxCountOrders-1) { if(SelAllProfit + BuyMaxPriceProfit >= MinTP*BuyPriceMaxLot && BuyMaxPriceProfit!=0) { CloseAllType(OP_SELL); CloseTicket(BuyPriceMaxTic,OP_BUY); tk=OrderSend(NULL,OP_BUY, NL(MathCeil(StartLot*100*LotK)/100),NormalizeDouble(Ask,_Digits),Slippage,0,0,"",MagicNumber); if(tk<0) return; else tk=OrderSend(NULL,OP_SELL,StartLot,NormalizeDouble(Bid,_Digits),Slippage,0,0,"",MagicNumber); } else { tk=OrderSend(NULL,OP_BUY, StartLot,NormalizeDouble(Ask,_Digits),Slippage,0,0,"",MagicNumber); if(tk<0) return; else tk=OrderSend(NULL,OP_SELL,StartLot,NormalizeDouble(Bid,_Digits),Slippage,0,0,"",MagicNumber); } } //--- if((AllProfit>=LevelStopProfit && LevelStopProfit!=0) || (-AllProfit>=LevelStopLoss && LevelStopLoss!=0)) CloseAll(); if(LevelBU>0) BU(); } //+------------------------------------------------------------------+ //| Закрытие позиции по тикету ордера | ></code>
5.… в канале минимально от 5-6 спредов. Лучше от 10-12-15-20.
6. — по 2 спреда в обе стороны на запазывание, проскальзывание. 2 спреда — прибыль.
Сохрани дэпозит сначала, заработаешь потом. На слитом дэпо точно не заработаешь.
<code>double LB=0,LS=0; for(int i=0; i<OrdersTotal(); i++) if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderSymbol()==Symbol() && OrderMagicNumber()==maga) { if(OrderType()==OP_BUY) LB+=OrderLots(); if(OrderType()==OP_SELL) LS+=OrderLots(); } </code>
Из трех вариантов лучшим оказался…
С разрешения Руслана выкладываю его для обсуждения.
kvashnin007