Hi. I have a problem with double entry (unexpectedly :) ) . Please, can you help me with my problem? In this topic often see function sleep(), but I don´t know, where to use it.
Thats my program:
//+------------------------------------------------------------------+//| Externí vstupní parametry strategie |//+------------------------------------------------------------------+externdouble Stoploss_v_pipech = 1000; // definice stop lossuexterndouble Profit_target_v_pipech = 2000; // definice profit targetuexterndouble Velikost_pozice = 0.01; // definice velikosti pozice pro obchodováníexterndouble ADXP = 14;
externdouble LMAP = 21;
externdouble SMAP = 5;
//+------------------------------------------------------------------+//| Expert initialization function |//+------------------------------------------------------------------+int init()
{return(0);}
//+------------------------------------------------------------------+//| Expert deinitialization function |//+------------------------------------------------------------------+int deinit()
{return(0);}
//+------------------------------------------------------------------+//| Expert start function |//+------------------------------------------------------------------+int start()
{
//+------------------------------------------------------------------+//| Definice proměnných |//+------------------------------------------------------------------+int D = DayOfWeek(); // zjistí den v týdnu (neděle=0 … pátek=5)int m = TimeMinute(TimeCurrent()); // zjistí aktuální minutuint h = TimeHour(TimeCurrent()); // zjistí aktuální hodinuint ticket, q, p, close; // proměnná pro zadání příkazu, počítadloint maxDuration = 5 * 60;
int duration = TimeCurrent() - OrderOpenTime();
double aLMA = iMA(Symbol(),PERIOD_M1,LMAP,0,MODE_LWMA,PRICE_CLOSE,2);
double bLMA = iMA(Symbol(),PERIOD_M1,LMAP,0,MODE_LWMA,PRICE_CLOSE,1);
double aSMA = iMA(Symbol(),PERIOD_M1,SMAP,0,MODE_LWMA,PRICE_CLOSE,2);
double bSMA = iMA(Symbol(),PERIOD_M1,SMAP,0,MODE_LWMA,PRICE_CLOSE,1);
double ADX = iADX(Symbol(),PERIOD_M1,ADXP,PRICE_CLOSE,0,1);
double SL = Stoploss_v_pipech*Point; // převod pipového stoplossu na cenové vyjádřenídouble PT = Profit_target_v_pipech*Point; // převod pipového profitu na cenové vyjádřeníint Magic_number = 1001; // identifikační číslo strategiestring Text = "Moje první strategie"; // komentář //+------------------------------------------------------------------+//| Výstup kontraktů |//+------------------------------------------------------------------+for(p = 0;p < OrdersTotal();p++)
{if(OrderSelect(p, SELECT_BY_POS, MODE_TRADES)==true && OrderMagicNumber()==Magic_number && duration > maxDuration) //&& duration > maxDuration)
{if(OrderType()==OP_BUY) {close=OrderClose(OrderTicket(),Velikost_pozice,Bid,2,Yellow);}
if(OrderType()==OP_SELL) {close=OrderClose(OrderTicket(),Velikost_pozice,Ask,2,Yellow);}}}
//+------------------------------------------------------------------+//| Omezovač počtu vstupů |//+------------------------------------------------------------------+for(q = 0; q < OrdersTotal(); q++)
{if(OrderSelect(q, SELECT_BY_POS, MODE_TRADES) && OrderMagicNumber()==Magic_number)
{return(0);}}
//+------------------------------------------------------------------+//| Podmínka pro prodej (SELL/SHORT) |//+------------------------------------------------------------------+if (D >= 1 && D < 5 && aLMA < aSMA && bLMA > bSMA && ADX > 25)
{ticket = OrderSend(Symbol(),OP_SELL,Velikost_pozice,Bid,0,Bid+SL,Bid-PT,Text, Magic_number,0,Red);}
//+------------------------------------------------------------------+//| Podmínka pro nákup (BUY/LONG) |//+------------------------------------------------------------------+if (D >= 1 && D < 5 && aLMA > aSMA && bLMA < bSMA && ADX > 25)
{ticket = OrderSend(Symbol(),OP_BUY,Velikost_pozice,Ask,0,Ask-SL,Ask+PT,Text, Magic_number,0,Blue);}
return(0);}
Hi. I have a problem with double entry (unexpectedly :) ) . Please, can you help me with my problem? In this topic often see function sleep(), but I don´t know, where to use it.
Hi. I have a problem with double entry (unexpectedly :) ) . Please, can you help me with my problem? In this topic often see function sleep(), but I don´t know, where to use it.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I thought there was updates on this thread which shows up as the 1st thread
so I believe there still isn't any updates from service desk right?
Hi. I have a problem with double entry (unexpectedly :) ) . Please, can you help me with my problem? In this topic often see function sleep(), but I don´t know, where to use it.
Thats my program:
Hi. I have a problem with double entry (unexpectedly :) ) . Please, can you help me with my problem? In this topic often see function sleep(), but I don´t know, where to use it.
Thats my program:
Hi. I have a problem with double entry (unexpectedly :) ) . Please, can you help me with my problem? In this topic often see function sleep(), but I don´t know, where to use it.
Thats my program:
Forum on trading, automated trading systems and testing trading strategies
Open 2 order
Wahoo, 2014.11.18 15:38