Download MetaTrader 5

Watch how to download trading robots for free

Interesting script?
So post a link to it -
let others appraise it

You liked the script? Try it in the MetaTrader 5 terminal

2014.02.17 13:07

MQL4 OnTrade() Alternative - expert for MetaTrader 4

| English Español Português 日本語 Deutsch

votes: 7
Simulator.mq4 (27.29 KB)view


Coders' Guru


While discovering the MQL4 New build (610) capabilities I found a very useful even OnTrade() highlighted in MetaEditor.

I clicked F1 to see its implementation but unfortunately it's not supported yet in MQL4.

That's why I created my own Simulator.

This code will raise events on these cases:

OnOpen: When open a new instant order.

OnModify: When the order modified.

OnStopLoss: When the order close because its StopLoss.

OnTakeProfit: When the order close because its TakeProfit.

OnClose: When the order close (Not by SL or TP).

Please give it a test and tell me your comments.


Coders' Guru


Tester example
    Accelerator Oscillator (AC) Accelerator Oscillator (AC)

    The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.

    Average Directional Movement Index (ADX) Average Directional Movement Index (ADX)

    The Average Directional Movement Index Indicator (ADX) helps to determine if there is a price trend.

    TP-SL_Removing TP-SL_Removing

    Immediately deletes the SL/TP of all positions.

    Closed_TOTAL Closed_TOTAL

    Total closure of all positions (winners/losers). You can also select which are of a single instrument.