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
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 | 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