Gamestudio Links
Zorro Links
Newest Posts
Alternative to Stooq for Zorro S
by cwford. 10/09/26 00:48
Stooq now requires an API key
by cwford. 10/08/26 23:27
ZorroGPT
by TipmyPip. 10/06/26 05:32
Purchase A8 full licence version
by jcl. 10/05/26 12:12
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
3 registered members (VoroneTZ, vince, TipmyPip), 12,467 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
JimSimons, julienp, julienper, KelleyAbbey, Yopachi
19246 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