What's wrong with that? - page 3 1234567 New comment asasusa 2011.11.23 08:52 #21 Please tell me why this script does not open deals and shows error 0, i.e. no error, but does not open deals. extern int MagicNumber = 10001; extern double Lots = 0.1; extern double StopLoss = 50; extern double TakeProfit = 50; extern int TrailingStop = 25; extern int Slippage = 3; //+------------------------------------------------------------------+ // expert start function //+------------------------------------------------------------------+ int start() { double MyPoint=Point; if(Digits==3 || Digits==5) MyPoint=Point*10; double StochMain = iStochastic(NULL,0,7,10,4,MODE_LWMA,1,MODE_MAIN,0); double StochSignal = iStochastic(NULL,0,7,10,4,MODE_LWMA,1,MODE_SIGNAL,0); double MaSi = iMA(NULL,0,100,0,MODE_EMA,PRICE_CLOSE,0); if( TotalOrdersCount()==0 ) { if((StochMain > StochSignal)&&(Close[1] > MaSi)) // Here is your open buy rule { OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Ask+StopLoss*MyPoint,Ask+TakeProfit*MyPoint,"Открыта сделка на покупку!!",MagicNumber,0,Yellow); } else { if(GetLastError() != 0) Alert("Ошибка ",GetLastError()); } } NADYA 2011.11.23 10:39 #22 I think your stoploss is bigger than the opening price asasusa 2011.11.23 11:48 #23 Right, and there's no error. asasusa 2011.11.23 11:59 #24 Tell me how to decipher this, I don't understand how this piece works for(int cnt=0;cnt<OrdersTotal();cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); So first we set the cnt variable to 0 Then, if the number of orders exceeds 0, OrderSelect is triggered. But what is this same variable cnt with value 0 responsible for? OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); NADYA 2011.11.23 12:17 #25 Try just reading about the function and it will be clear in no time. asasusa 2011.11.23 12:32 #26 No nothing has become clear, why exactly 0? Are the orders numbered from zero or what? And there is more. OrderType()<=OP_SELL How do I know if this is less than or equal to a sell order? Which one is smaller and which one is bigger? Automated Trading Championship 2010 [WARNING CLOSED!] Any newbie Any rookie question, so --- 2011.11.23 14:13 #27 sss2019: No nothing has become clear, why exactly 0? Are the orders numbered from zero or what? yep, from scratch. just like everything else. And there is more. How do I know if this is less than or equal to a sell order? How do we know which one is smaller and which one is bigger? because OP_SELL is constant=1 asasusa 2011.11.23 15:59 #28 So OP_BUY - 0 OP_SELL - 1 OP_BUYLIMIT - 2 OP_BUYSTOP - 3 OP_SELLLIMIT - 4 OP_SELLSTOP - 5 that's how it works? Victor Nikolaev 2011.11.23 16:10 #29 sss2019: So OP_BUY - 0 OP_SELL - 1 OP_BUYLIMIT - 2 OP_BUYSTOP - 3 OP_SELLLIMIT - 4 OP_SELLSTOP - 5 that's how it works? Right. True, there is another value that equals 6. asasusa 2011.11.23 17:07 #30 What else is it going to be? 1234567 New comment
Please tell me why this script does not open deals and shows error 0, i.e. no error, but does not open deals.
Tell me how to decipher this, I don't understand how this piece works
So first we set the cnt variable to 0
Then, if the number of orders exceeds 0, OrderSelect is triggered.
But what is this same variable cnt with value 0 responsible for?
No nothing has become clear, why exactly 0? Are the orders numbered from zero or what?
And there is more.
OrderType()<=OP_SELLHow do I know if this is less than or equal to a sell order? Which one is smaller and which one is bigger?
No nothing has become clear, why exactly 0? Are the orders numbered from zero or what?
yep, from scratch. just like everything else.
And there is more.
How do I know if this is less than or equal to a sell order? How do we know which one is smaller and which one is bigger?
because OP_SELL is constant=1
So
OP_BUY - 0
OP_SELL - 1
OP_BUYLIMIT - 2
OP_BUYSTOP - 3
OP_SELLLIMIT - 4
OP_SELLSTOP - 5
that's how it works?
So
OP_BUY - 0
OP_SELL - 1
OP_BUYLIMIT - 2
OP_BUYSTOP - 3
OP_SELLLIMIT - 4
OP_SELLSTOP - 5
that's how it works?
Right. True, there is another value that equals 6.