Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (fairtrader, Quad, miwok, Martin_HH, AndrewAMD, alibaba, dpn), 581 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 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,967
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

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

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,967
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