Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (7th_zorro, 1 invisible), 942 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Negative values in exitLong() #434158
12/15/13 14:38
12/15/13 14:38
Joined: Dec 2013
Posts: 14
O
oligodar Offline OP
Newbie
oligodar  Offline OP
Newbie
O

Joined: Dec 2013
Posts: 14
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

Re: Negative values in exitLong() [Re: oligodar] #434160
12/15/13 16:03
12/15/13 16:03
Joined: Jul 2013
Posts: 522
D
dusktrader Offline
User
dusktrader  Offline
User
D

Joined: Jul 2013
Posts: 522
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.

Re: Negative values in exitLong() [Re: dusktrader] #434162
12/15/13 17:07
12/15/13 17:07
Joined: Dec 2013
Posts: 14
O
oligodar Offline OP
Newbie
oligodar  Offline OP
Newbie
O

Joined: Dec 2013
Posts: 14
Thank you Dusktrader,

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

Thank you


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1