Ayuda para afinar un asesor, un indicador - página 5 123456789101112 Nuevo comentario FXwin 2018.03.21 18:04 #41 Natalya Dzerzhinskaya: ¿Cómo se identifican las barras de clavijas en los diferentes TFs?Esa es una gran manera de identificarse)) 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 [Eliminado] 2018.03.21 18:15 #42 FXwin: Esa es la forma de definirlo:)) ¡¡¡Buena opción!!! Gracias)) Vitaly Muzichenko 2018.03.22 05:53 #43 Natalya Dzerzhinskaya: ¡¡¡Buena opción!!! Gracias))Con el permiso del autor, voy a publicar una función multiplataforma //=============================================================================================== //---------------------------------- Функция находит Пин-бар -----------------------------------+ //=============================================================================================== 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: Con el permiso del autor, voy a publicar una función multiplataforma Sólo estoy "A FAVOR" de la participación)) Romal001 2018.03.23 13:42 #45 ¡Hola! Ayúdame a configurar el robot. Le he añadido una hora de cierre y no funciona. Archivos adjuntos: 0j1_uhskn.mq4 14 kb FXwin 2018.03.23 14:49 #46 Romal001: Le he añadido una hora de cierre y no funciona.He añadido el tiempo pero no he añadido el proceso de cierre)) 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; } Así. Romal001 2018.03.23 15:03 #48 Romal001: Así.Lo tengo, no así y no así, no funciona. Romal001 2018.03.23 15:04 #49 if(closeneed && OrdersTotal()>0){ CloseBuy(); CloseSell(); FXwin 2018.03.23 15:21 #50 Romal001: Corregido por Archivos adjuntos: 0j1_uhskn_v1.0.mq4 18 kb 123456789101112 Nuevo comentario
¿Cómo se identifican las barras de clavijas en los diferentes TFs?
Esa es una gran manera de identificarse))
Esa es la forma de definirlo:))
¡¡¡Buena opción!!! Gracias))
¡¡¡Buena opción!!! Gracias))
Con el permiso del autor, voy a publicar una función multiplataforma
Con el permiso del autor, voy a publicar una función multiplataforma
Sólo estoy "A FAVOR" de la participación))
Le he añadido una hora de cierre y no funciona.
He añadido el tiempo pero no he añadido el proceso de cierre))
Así.
Lo tengo, no así y no así, no funciona.
Corregido por