Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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
2 registered members (AndrewAMD, Ayumi), 838 guests, and 2 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
Symbols Loop #487853
10/17/23 08:20
10/17/23 08:20
Joined: Sep 2023
Posts: 18
Freiburg
S
steyr Offline OP
Newbie
steyr  Offline OP
Newbie
S

Joined: Sep 2023
Posts: 18
Freiburg
Hello there,

i want to trade several symbols f.i. EUR/USD ; AUD/USD ; GER30

The problem:

Since I have three functions in my script: the bar(), where I utilize different candlestick patterns; the run() where the initialization settings are located; and also the symbol loop and the tick() function, as I need to open or close positions within a bar. Does anyone have an idea on how I could incorporate the loop into my extraordinary script?"

The Code snippet:

Code
int bar(vars Open,vars High,vars Low,vars Close)
{
       //Volume Based bars or sth. else
}

function run()
{
	
	
	Capital = 1000;
	set(PARAMETERS|LOGFILE|PLOTNOW);
	StartDate = 20120101;
	EndDate = 20230101;    //StartDate + 0100; // 1 month
	StopFactor = 0;
	

	while(asset(loop("EUR/USD","GER30","AUD/USD"))) // the asset Loop
        {
        // normally i have to put the strategy conditions into this while-loop, unfortunately it is into the tick()
        }


}

	
function tick()
{
        if(trend) enterLong();
        else enterShort();
}


thank you for your Help



Last edited by steyr; 10/17/23 08:24.
Re: Symbols Loop [Re: steyr] #487854
10/17/23 11:23
10/17/23 11:23
Joined: Feb 2017
Posts: 1,731
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,731
Chicago
Check out the for(listed_assets) macro, which can be used outside of run().

Re: Symbols Loop [Re: steyr] #487864
10/19/23 18:22
10/19/23 18:22
Joined: Sep 2023
Posts: 18
Freiburg
S
steyr Offline OP
Newbie
steyr  Offline OP
Newbie
S

Joined: Sep 2023
Posts: 18
Freiburg
Thanks Andrew, i will try it laugh


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1