Download MetaTrader 5

how to send buy orders in Iranian stock market?

To add comments, please log in or register
They are making profit already using Freelance service. You can join them!
sd2000sd
212
sd2000sd 2014.01.30 07:07 

Please, can someone give a simple example of how to send a buyLimit order for a symbol in Iranian Stock Market.

I had have a lot of problems doing it.

I need a sample code. 

Thanks in advance. 

Mehrdad Shiri
4480
Mehrdad Shiri 2014.01.30 07:41  
sd2000sd:

Please, can someone give a simple example of how to send a buyLimit order for a symbol in Iranian Stock Market.

I had have a lot of problems doing it.

I need a sample code. 

Thanks in advance. 

hi

#include <Trade/Trade.mqh>
MqlTradeRequest trReq;
MqlTradeResult trRez;

//+------------------------------------------------------------------+
void OnTick()
  {
   ENTER1= ?  
   ENTER_STOP_LIMIT_1=?     
   LOT=?;  
   Buy_Stop_Trade_Sub_Program(ENTER1,ENTER_STOP_LIMIT_1);
//----      
   return;
   } 
//------------------------------------- Buy_Stop_Trade_Sub_Program --------------------------------
void Buy_Stop_Trade_Sub_Program(double ENTER_PRICE, double ENTER_STOP_LIMIT)
    {
      trReq.symbol=Symbol();
      trReq.action=TRADE_ACTION_PENDING;                         
      trReq.deviation=10;                                        
      trReq.price=ENTER_PRICE;  
      trReq.stoplimit=ENTER_STOP_LIMIT;
      trReq.sl=0;    
      trReq.tp=0;          
      trReq.type=ORDER_TYPE_BUY_STOP_LIMIT;              
      trReq.volume=LOT;
      trReq.type_filling = ORDER_FILLING_RETURN;
      OrderSend(trReq,trRez);
    }
sd2000sd
212
sd2000sd 2014.01.30 07:51  
TIMisthebest:

hi

I used the above code when the market is closed and I get this result in the journal part:

failed buy stop limit 1k at symbolName 3740 (1000) [Invalid Price] 

of course symbolName is the name of my own symbol. not that exact text. 

Mehrdad Shiri
4480
Mehrdad Shiri 2014.01.30 08:15  
sd2000sd:

I used the above code when the market is closed and I get this result in the journal part:

failed buy stop limit 1k at symbolName 3740 (1000) [Invalid Price] 

of course symbolName is the name of my own symbol. not that exact text. 

void OnTick()

effect when each tick be recieved.

please show your code you use it .

sd2000sd
212
sd2000sd 2014.01.30 08:16  
TIMisthebest:

effect when each tick will be recieved.

I used a timer to run that subFunction.
Mehrdad Shiri
4480
Mehrdad Shiri 2014.01.30 08:26  
sd2000sd:
I used a timer to run that subFunction.
show your code
sd2000sd
212
sd2000sd 2014.02.01 06:44  
TIMisthebest:

hi

the above code returns error 10006.
khodamyeki
5
khodamyeki 2016.09.19 08:26  

how can find a solution for below error?

10026

TRADE_RETCODE_SERVER_DISABLES_AT

Autotrading disabled by server


i cant add order in metatrader with iranian server?

To add comments, please log in or register