How does the Take Profit works on MT5?

 

Hello,

I would like to understand how the TP works...

If I open a request to open a trade like this:

request = {
        "action": mt5.TRADE_ACTION_DEAL,
        "symbol" : "GOLDmicro",
        "volume" : 0.1,
        "type" : mt5.ORDER_TYPE_BUY,
        "price" : mt5.symbol_info_tick("GOLDmicro").ask,
        "SL" : 0.0,
        "TP": 0.0,
        "deviation" : 20000,
        "magic" : 123456,
        "comment" : "TEST",
        "type_time" : mt5.ORDER_TIME_GTC,
        "type_filling" : mt5.ORDER_FILLING_IOC,
}

order = mt5.order_send(request)
print(order)


I can insert whatever I want on the "TP" line (I tried with numbers, I tried with variable, I tried with formula) my order will be open without error but a TP at "0.0".

and If I open a request without TP and after that I try to use the mt5.TRADE_ACTION_SLTP which seems to be needed to modify a SL & TP it never works. No error message but nothing change...


request = {
        "action": mt5.TRADE_ACTION_DEAL,
        "symbol" : "GOLDmicro",
        "volume" : 0.1,
        "type" : mt5.TRADE_ACTION_SLTP,
        "price" : price,
        "SL" : 0.0,
        "TP": price + (100 * point),
        "deviation" : 20,
        "magic" : 123456,
        "comment" : "TEST",
        "type_time" : mt5.ORDER_TIME_GTC,
        "type_filling" : mt5.ORDER_FILLING_IOC,
}

order = mt5.order_send(request)
print(order)