Download MetaTrader 5
To add comments, please log in or register
MQL5 Reference is available in 8 languages. Learn MQL5 in the language that suits you best!
Route206
211
Route206 2015.06.25 14:11 

any idea why:

         prices[i][2]=OrderSend(instrument[i],OP_SELL,portie,Bid,3,0,0);
         if(prices[i][2]!=-1)
            {
            Alert("short : ",instrument[i]);
            }
            else
               {
               Alert("Error on ",instrument[i]," error_code: ",GetLastError());
               }

alsways works, except for any JPY pairs which give me error 

4107

ERR_INVALID_PRICE_PARAM

Invalid price

 

so weird and I don't know where to start looking - anything else besides JPY works fine. A broader slippage doesn't work either.

really puzzled. 

Alain Verleyen
Moderator
28659
Alain Verleyen 2015.06.25 17:04  
Bid is only valid for the current chart symbol.
whroeder1
13644
whroeder1 2015.06.25 17:57  
 prices[i][2]=OrderSend(instrument[i],OP_SELL,portie,Bid,3,0,0);
  1. Do not trade multiple currencies, you can't use any predefined variables, can't use the tester, must poll (not OnTick,) and usually other problems.
  2. Code it to trade the chart pair only. Look at the other's if you must.
  3. Then put it on other charts to trade the other pairs. Done.
Route206
211
Route206 2015.06.25 17:59  

Good catch - should have known that! ;-)

I guess the below will work a lot better then! 

         prices[i][2]=OrderSend(instrument[i],OP_SELL,portie,MarketInfo(instrument[i],MODE_BID),3,0,0);
         if(prices[i][2]!=-1)
            {
            Alert("short : ",instrument[i]);
            }
            else
               {
               Alert("Error on ",instrument[i]," error_code: ",GetLastError());
               }

thanks 

Route206
211
Route206 2015.06.25 18:02  
WHRoeder:
  1. Do not trade multiple currencies, you can't use any predefined variables, can't use the tester, must poll, and usually other problems.
  2. Code it to trade the chart pair only. Look at the other's if you must.
  3. Then put it on other charts to trade the other pairs. Done.

i'm sure that is the better approach - this is one however is where we're testing a basket and it behavior relative to others and eachother. 

As such, it serves a purpose ;-) 

/
To add comments, please log in or register