Can you check why is my EA not placing tp and sl on market orders ?

1
my ea uses pending and market orders to place trades when conditions met ,, however it is not placing any tp or sl on market orders ,, i tried changing the code and disable market orders even ,, but i ran into many orders ... help me please ?

my try to disable market orders (faild) :

// Disable market orders
bool send_order = false;

// Check if the order type is market
if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
send_order = false;
}


Re: Can you check why is my EA not placing tp and sl on market orders ?

2
I see that your favorite indicator in your forum profile is Renko in MT4, and your OrderSend code uses NULL as the traded symbol. If you're running the EA on an offline Renko chart, I'm not sure if NULL as the traded symbol within the EA's OrderSend function will work. I also see that your Symbol() code seems to be working. Maybe try replacing NULL with Symbol(). Of course, you must have Offline Chart unchecked in your MT4 chart properties.

Also, I see that your code incorporates your stops (SL's and TP's) into your initial order. if you're trading with an ECN broker, your stops must be sent in a separate order modification after an initial naked order has been sent.
“[A]s we know, there are known knowns—there are things we know we know. We also know there are known unknowns—that is to say we know there are some things we do not know. But there are also unknown unknowns—the ones we don’t know we don’t know.”—Donald Rumsfeld, 2002

Re: Can you check why is my EA not placing tp and sl on market orders ?

3
One more thing... If your Renko chart generator creates a unique custom symbol like EURUSD_Renko, then you'll have to hard code the source chart symbol (EURUSD) into all of your EA's trading code (OrderSend, OrderClose, OrdersTotal, etc.). Your technical analysis/conditions code can continue to use Symbol(). In this way, your EA analyzes the offline chart but executes all trade related functions based on the standard source chart.
“[A]s we know, there are known knowns—there are things we know we know. We also know there are known unknowns—that is to say we know there are some things we do not know. But there are also unknown unknowns—the ones we don’t know we don’t know.”—Donald Rumsfeld, 2002


Who is online

Users browsing this forum: No registered users and 19 guests