how I set minimum value of take profit?

 

hello

I have  a problem.

If I input a value which is lower than minimum of take-profit, then I would like to show log.

I think mininum of stoploss is "MarketInfo(symbol, MODE_STOPLEVEL)", but I have no idea  how can I get the minumum of take profit...

could you help me?

thank you in advance.

 
If I input a value which is lower than minimum of take-profit, then I would like to show log.

I think mininum of stoploss is "MarketInfo(symbol, MODE_STOPLEVEL)", but I have no idea  how can I get the minumum of take profit...

MODE_STOPLEVEL is a distance.

It's the minimum distance from price to SL and from price to TP.

Price is either Bid or Ask, which depends upon which direction your trade is going (LONG or SHORT).

So, for ORDER_TYPE_BUY, something like this should work

if ( tp - Ask <= minStopsLevel ) Print("TP too close");
 
Anthony Garot:

It's the minimum distance from price to SL and from price to TP.

Price is either Bid or Ask, which depends upon which direction your trade is going (LONG or SHORT).

So, for ORDER_TYPE_BUY, something like this should work

Thank you Anthony Garot!

You were a big help!

 
Par duck:

hello

I have  a problem.

If I input a value which is lower than minimum of take-profit, then I would like to show log.

I think mininum of stoploss is "MarketInfo(symbol, MODE_STOPLEVEL)", but I have no idea  how can I get the minumum of take profit...

could you help me?

thank you in advance.

You have to get it from market info...


minSLTPdstnc = MarketInfo(Symbol(), MODE_STOPLEVEL);
 
Ali Sabbaghi:

You have to get it from market info...


I want to get min take profit.

But thank you Ali Sabbaghi :)

 
Par duck:

I want to get min take profit.

But thank you Ali Sabbaghi :)

As already mentioned by Anthony Garot

It's the minimum distance from price to SL and from price to TP.

don't forget that 

MODE_STOPLEVEL

returns the value in points so you will need to multiply it by Point to get the decimal value.

 
Keith Watford:

As already mentioned by Anthony Garot

It's the minimum distance from price to SL and from price to TP.

don't forget that 

MODE_STOPLEVEL

returns the value in points so you will need to multiply it by Point to get the decimal value.

Ah.. OK Thank you Keith Watford!

Reason: