Gamestudio Links
Zorro Links
Newest Posts
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
Release 2.68 replacement of the .par format
by Martin_HH. 09/23/25 20:48
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 17,605 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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: 28,022
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,022
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 | 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