Help to fine tune an advisor, an indicator - page 5 123456789101112 New comment FXwin 2018.03.21 18:04 #41 Natalya Dzerzhinskaya: How do you identify pinbars on different TFs?That's a great way to identify)) extern int TF = 60; //Тайм фрейм на котором определяем пинбары //--- bool PinbarLong, PinbarShort; //--- int start() { PinbarLong = MathMin(iOpen(Symbol(), TF, 1),iClose(Symbol(), TF, 1))- iLow(Symbol(), TF, 1) >= (iHigh(Symbol(), TF, 1)-iLow(Symbol(), TF, 1))*0.75; PinbarShort = iHigh(Symbol(), TF, 1)- MathMax(iOpen(Symbol(), TF, 1),iClose(Symbol(), TF, 1)) >= (iHigh(Symbol(), TF, 1)-iLow(Symbol(), TF, 1))*0.75; if (PinbarLong) действие для buy; if (PinbarShort) действие для sell; return(0);}//StartEnd [Deleted] 2018.03.21 18:15 #42 FXwin: That's the way to define it:)) Good option!!! Thank you)) Vitaly Muzichenko 2018.03.22 05:53 #43 Natalya Dzerzhinskaya: Good option!!! Thanks))With the author's permission, I'll post a cross-platform feature //=============================================================================================== //---------------------------------- Функция находит Пин-бар -----------------------------------+ //=============================================================================================== MqlRates _rates[1]; int GetPinBar(string symb="0", ENUM_TIMEFRAMES tf=0, double kf=0.75) { if(symb=="0") symb=Symbol(); double open1=0,high1=0,low1=0,close1=0; CopyRates(symb,tf,1,1,_rates); open1=rates[0].open; high1=rates[0].high; low1=rates[0].low; close1=rates[0].close; if(MathMin(open1,close1)-low1 >=(high1-low1)*kf) return(1); if(high1-MathMax(open1,close1)>=(high1-low1)*kf) return(2); return(0); } FXwin 2018.03.22 11:31 #44 Vitaly Muzichenko: With the author's permission, I'll post a cross-platform feature I am only "FOR" participation)) Romal001 2018.03.23 13:42 #45 Hello! Help me set up the robot. Added a closing time to it and it's not working. Files: 0j1_uhskn.mq4 14 kb FXwin 2018.03.23 14:49 #46 Romal001: I added a closing time to it and it doesn't work.I added the time but did not add the closing process)) Romal001 2018.03.23 15:01 #47 int BuyOrders() { int co,t; for(co=0; co<OrdersTotal(); co++) { if(OrderSelect(co,SELECT_BY_POS)) if(OrderSymbol()==Symbol()) if(OrderMagicNumber()==Magik) { if(OrderType()==OP_BUY) t++; } } return(t); } int SellOrders() { int cp,t; for(cp=0; cp<OrdersTotal(); cp++) { if(OrderSelect(cp,SELECT_BY_POS)) if(OrderSymbol()==Symbol()) if(OrderMagicNumber()==Magik) { if(OrderType()==OP_SELL) t++; } } return(t); } void CloseSell() { int t; while(SellOrders()>0) { for(int c=0; c<=OrdersTotal();c++) { if(OrderSelect(c,SELECT_BY_POS, MODE_TRADES)) if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magik)// { if(OrderType()==OP_SELL) { for(t=0; t<=5; t++) { RefreshRates(); int ticket=OrderClose(OrderTicket(),OrderLots(),Ask,10,Red); int e=GetLastError(); if(e==0) break; else Print("error close Sell : "+e); } } } } } return; } void CloseBuy() { int t; while(BuyOrders()>0) { for(int c=0; c<=OrdersTotal();c++) { if(OrderSelect(c,SELECT_BY_POS, MODE_TRADES)) if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magik) // { if(OrderType()==OP_BUY) { for(t=0; t<=5; t++) { RefreshRates(); int ticket=OrderClose(OrderTicket(),OrderLots(),Bid,10,Red); int e=GetLastError(); if(e==0) break; else Print("error close Sell : "+e); } } } } } return; } Like this. Romal001 2018.03.23 15:03 #48 Romal001: Like this.I have it, not so and not so, it doesn't work. Romal001 2018.03.23 15:04 #49 if(closeneed && OrdersTotal()>0){ CloseBuy(); CloseSell(); FXwin 2018.03.23 15:21 #50 Romal001: Corrected by Files: 0j1_uhskn_v1.0.mq4 18 kb 123456789101112 New comment
How do you identify pinbars on different TFs?
That's a great way to identify))
That's the way to define it:))
Good option!!! Thank you))
Good option!!! Thanks))
With the author's permission, I'll post a cross-platform feature
With the author's permission, I'll post a cross-platform feature
I am only "FOR" participation))
I added a closing time to it and it doesn't work.
I added the time but did not add the closing process))
Like this.
I have it, not so and not so, it doesn't work.
Corrected by