Negative values in exitLong()

Posted By: oligodar

Negative values in exitLong() - 12/15/13 14:38

Code:
TRADE* reverseLong(int MaxTrades)
{
// update the stops and profit targets of open trades
  if(Stop > 0) 
    exitLong(0,priceClose()-Stop);
  if(TakeProfit > 0) 
    exitLong(0,-(priceClose()+TakeProfit));
 
// if MaxTrades is not reached, open a new trade
  if(NumOpenLong < MaxTrades or Train)
    trade = enterLong();
// otherwise, close opposite trades if not hedging
  else if(Hedge <= 1)
    exitShort();
  return 0;
}



Hi, could sb explain me this line from tutorial:

exitLong(0,-(priceClose()+TakeProfit));

For example:

price close is: 100
take profit is: 10


So it would be:

exitLong(0,-110);

How could be price for exiting long trades negative?


Thank you
Posted By: dusktrader

Re: Negative values in exitLong() - 12/15/13 16:03

Hi oligodar,
in the manual here it explains this optional second parameter:
Quote:
Optional price or price distance for selling the position, or 0 for selling at market. A positive price or price distance constitutes an exit stop, a negative price is an exit limit (similar to Entry). An exit stop closes the position when the asset price is at or worse than the given price, like a stop loss; an exit limit closes the position when the asset price is at or better than the given price, like a profit target.
Posted By: oligodar

Re: Negative values in exitLong() - 12/15/13 17:07

Thank you Dusktrader,

I am sorry. I overlooked it. Now I got it.

Thank you
© 2024 lite-C Forums