how I set minimum value of take profit?

To add comments, please log in or register
Par duck
90
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.

Anthony Garot
1954
Anthony Garot  
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");
Par duck
90
Par duck  
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!

Ali Sabbaghi
571
Ali Sabbaghi  
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);
Par duck
90
Par duck  
Ali Sabbaghi:

You have to get it from market info...


I want to get min take profit.

But thank you Ali Sabbaghi :)

Keith Watford
Moderator
14520
Keith Watford  
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.

Par duck
90
Par duck  
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!

To add comments, please log in or register