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
0 registered members (), 1,218 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
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: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
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: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

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


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