Gamestudio Links
Zorro Links
Newest Posts
nba2king Latest Roster Update Breakdown
by joenxxx. 10/14/25 06:06
Help!
by VoroneTZ. 10/14/25 05:04
Zorro 2.70
by jcl. 10/13/25 09:01
ZorroGPT
by TipmyPip. 10/12/25 13:58
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 10/11/25 18:45
Reality Check results on my strategy
by dBc. 10/11/25 06:15
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (Quad, AndrewAMD), 9,200 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
joenxxx, Jota, krishna, DrissB, James168
19170 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Reverse trades - maximum limit with single reversal? #429708
09/17/13 06:24
09/17/13 06:24
Joined: Aug 2013
Posts: 28
--Select a State--
C
CL1 Offline OP
Newbie
CL1  Offline OP
Newbie
C

Joined: Aug 2013
Posts: 28
--Select a State--
Hi,

After studying the manual, I am unclear if reverse will give the following desired behavior:

A sell signal is encountered and one short position opened. Four more sell signals are encountered and 4 short positions are opened to the maximum allowed (5). Two more sell signals are encountered and ignored. A buy signal is encountered and all 5 short positions are closed with 1 long position opened.

Is this how reverseShort and reverseLong work?

if (sell_signal) {
reverseShort(5); }
else if(buy_signal) {
reverseLong(5); }

Thanks!

Re: Reverse trades - maximum limit with single reversal? [Re: CL1] #429718
09/17/13 11:07
09/17/13 11:07
Joined: Jul 2000
Posts: 28,028
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,028
Frankfurt
Yes, that's how they work. You can see their source code in default.c.

Re: Reverse trades - maximum limit with single reversal? [Re: jcl] #429762
09/18/13 07:03
09/18/13 07:03
Joined: Aug 2013
Posts: 28
--Select a State--
C
CL1 Offline OP
Newbie
CL1  Offline OP
Newbie
C

Joined: Aug 2013
Posts: 28
--Select a State--
Thanks, but the source code doesn't seem to do what I described. Ignoring updating stops and take profit in reverseLong, we are left with:

// if MaxTrades is not reached, open a new trade
if(NumOpenLong < MaxTrades)
return enterLong();
// otherwise, close any opposite trades
else if(!mode(HEDGING))
exitShort();

Perhaps I am off base, but wouldn't this have the action of closing all short positions only if the number of long positions open is equal to Max? I don't understand the "otherwise" - shouldn't it close all opposite in all situations? I was expecting something more like:

// close all opposite trades
if(NumOpenShort > 0)
exitShort();
// if MaxTrades is not reached, open a new trade
if(NumOpenLong < MaxTrades)
return enterLong();

Or am I in error?

Re: Reverse trades - maximum limit with single reversal? [Re: CL1] #429769
09/18/13 10:57
09/18/13 10:57
Joined: Jul 2000
Posts: 28,028
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,028
Frankfurt
It closes all opposite positions. Either with enterLong() or with exitShort().


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