Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, degenerate_762, ozgur), 1,311 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
reverseLong/Short side effects #466783
07/02/17 17:41
07/02/17 17:41
Joined: Dec 2013
Posts: 568
Fuerth, DE
Sphin Offline OP
User
Sphin  Offline OP
User

Joined: Dec 2013
Posts: 568
Fuerth, DE
Examining some strange behaviour of a script I read following in the remarks of the enterLong-etc-page in the manual:

Quote:
reverseLong/Short are helper functions ... If Stop, TakeProfit, or ExitTime is used, open trades in the same direction are updated with the new stop loss and take profit values ...

Unlike enterLong/Short Stop and TakeProfit seem to influence also open trades. If I have:

Code:
int TMF() {
  // modify Stop/Takeprofit if some conditions are met
}

function run() {
  ...
  Stop = 250 * PIP;
  TakeProfit = 550 * PIP;

  ...
  reverseLong(1, TMF);
  ...
  reverseShort(1, TMF);

}


Will Stop and TakeProfit be (re)set to the values from the run function (250/550 * PIP) each run if not modified by the TMF?

Re: reverseLong/Short side effects [Re: Sphin] #466801
07/03/17 09:44
07/03/17 09:44
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Yes, in fact those side effects are the main reason for the reverse functions. When a trade signal is triggered, but no new trade is opened since the maximum of trades is already reached, you normally want to update their stop and profit targets to the current price level. So they behave as if just opened.

If this is not desired, then simply use something like if(NumOpenLong < MyLimit) enterLong(); instead of the reverse functions.


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1