Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, TipmyPip, VoroneTZ, Quad, 1 invisible), 688 guests, and 11 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
One trade per Algo #467368
07/28/17 17:27
07/28/17 17:27
Joined: Dec 2016
Posts: 43
F
Fiber Offline OP
Newbie
Fiber  Offline OP
Newbie
F

Joined: Dec 2016
Posts: 43
Hi,
How can I limit only one trade/open position per Algo?
I tried
Code:
string CurrentAlgo = Algo;
for(open_trades)
if(strstr(Algo,CurrentAlgo) && !TradeIsOpen)


also
Code:
if(Algo == "TRND" &&  && NumOpenTotal == 0)


but without success.

Re: One trade per Algo [Re: Fiber] #467369
07/28/17 18:42
07/28/17 18:42
Joined: Feb 2017
Posts: 369
D
Dalla Offline
Senior Member
Dalla  Offline
Senior Member
D

Joined: Feb 2017
Posts: 369
You are making it a bit more difficult than it is I think.
NumOpenTotal is per asset/algo, so you don't need to check what algo is currently in use.

From the manual

Code:
Limit the number of open positions
// max. 3 open long positions per asset/algo
if(my_long_condition == true) {
  exitShort(); // no hedging - close all short positions
  if(NumOpenLong < 3) enterlong();
}



Or just use reverseLong/reverseShort so e.g. instead of enterLong()
use reverseLong(x) where x is the maximum number if open positions allowed.

Re: One trade per Algo [Re: Dalla] #467370
07/28/17 19:55
07/28/17 19:55
Joined: Dec 2016
Posts: 43
F
Fiber Offline OP
Newbie
Fiber  Offline OP
Newbie
F

Joined: Dec 2016
Posts: 43
Thank you for idea, Dalla!
I use manual almost every day and still many good ideas not discovered there for me:)
Also it seems that NumOpenLong and NumOpenShort works well to limit number of trades, but NumOpenTotal doesn't and that's why I went wrong way..

Last edited by Fiber; 07/28/17 20:37.

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