Please ask all Zorro Trader questions in the Zorro Trader forum. You need to sign up first.
Quote from fxsurgeon on November 2, 2024, 9:37 amI am relatively new to Zorro, coming from MQL4/5.
Studying the basics (like BarPeriod, TimeFrame, frameSync, etc) has not proven to elevate my understanding on how exactly Zorro delivers price data.
To complicate the matter, my trading system makes decisions at different timeframes and executes at different timeframes, for example M15 and D1.
So, how in the world do I make decisions at the M15 level in relation to D1 price levels in Zorro?
I will be very grateful to anyone who can explain this. Thank you!
I am relatively new to Zorro, coming from MQL4/5.
Studying the basics (like BarPeriod, TimeFrame, frameSync, etc) has not proven to elevate my understanding on how exactly Zorro delivers price data.
To complicate the matter, my trading system makes decisions at different timeframes and executes at different timeframes, for example M15 and D1.
So, how in the world do I make decisions at the M15 level in relation to D1 price levels in Zorro?
I will be very grateful to anyone who can explain this. Thank you!
Quote from Algo Mike on November 25, 2024, 5:51 pmHi fxsurgeon and welcome to the forum!
Here's a link to a very simple example of using two different time frames in Zorro Trader:
https://zorro-project.com/manual/en/tutorial_kelly.htm
Please note that in their script, the BarPeriod is 60 minutes. In the tradeCounterTrend() function, the internal Zorro Trader variable TimePeriod is used, and set to 4 (meaning four hourly bars, thus 4 hours). In the tradeTrend() function, the same variable is used to set an hourly time frame for this second trading strategy. This is, at the most basic level, how you would use two different time frames in the same strategy.
If you have specific questions, or code that does not work correctly, please post here.
Hi fxsurgeon and welcome to the forum!
Here's a link to a very simple example of using two different time frames in Zorro Trader:
https://zorro-project.com/manual/en/tutorial_kelly.htm
Please note that in their script, the BarPeriod is 60 minutes. In the tradeCounterTrend() function, the internal Zorro Trader variable TimePeriod is used, and set to 4 (meaning four hourly bars, thus 4 hours). In the tradeTrend() function, the same variable is used to set an hourly time frame for this second trading strategy. This is, at the most basic level, how you would use two different time frames in the same strategy.
If you have specific questions, or code that does not work correctly, please post here.
Quote from fxsurgeon on December 3, 2024, 3:13 amThank you Algo Mike for the explanation and the example.
How about fetching D1 price information (say current Day High and Low) at a certain time of the day? In which function should this happen?
Thank you Algo Mike for the explanation and the example.
How about fetching D1 price information (say current Day High and Low) at a certain time of the day? In which function should this happen?
Quote from Mustafa Durmaz on December 4, 2024, 9:14 amHi fxsurgeon,
If you git the current Version of zorro, there are already dayhigh and Daylow Functions. Open help document, click search tab, type "dayhigh".
Hi fxsurgeon,
If you git the current Version of zorro, there are already dayhigh and Daylow Functions. Open help document, click search tab, type "dayhigh".
Quote from fxsurgeon on December 15, 2024, 11:41 amQuote from Mustafa Durmaz on December 4, 2024, 9:14 amHi fxsurgeon,
If you git the current Version of zorro, there are already dayhigh and Daylow Functions. Open help document, click search tab, type "dayhigh".
I did some tests with dayHigh, dayLow, etc. functions. I can't get them to work as intended. Here is some code to illustrate the issue:
function run()
{
BarPeriod=15;// Daily TF
TimeFrame = 96;
vars highs = series(priceH(),3);
vars lows = series(priceL(),3);TimeFrame = 1;
// Original timeframe routines go below
At the daily timeframe run I fetch some daily price series. However, if I didn't use "TimeFrame=96" and instead used only "dayHigh" and "dayLow", I would not get the same daily prices.
Any ideas?
Quote from Mustafa Durmaz on December 4, 2024, 9:14 amHi fxsurgeon,
If you git the current Version of zorro, there are already dayhigh and Daylow Functions. Open help document, click search tab, type "dayhigh".
I did some tests with dayHigh, dayLow, etc. functions. I can't get them to work as intended. Here is some code to illustrate the issue:
function run()
{
BarPeriod=15;// Daily TF
TimeFrame = 96;
vars highs = series(priceH(),3);
vars lows = series(priceL(),3);TimeFrame = 1;
// Original timeframe routines go below
At the daily timeframe run I fetch some daily price series. However, if I didn't use "TimeFrame=96" and instead used only "dayHigh" and "dayLow", I would not get the same daily prices.
Any ideas?
Quote from fxsurgeon on December 18, 2024, 6:37 pmGuys, I really don't understand how this works. Have a look at the following code:
function run()
{
BarPeriod = 15;
TimeFrame = 1;
// do something every M15 barTimeFrame = 96;
printf("\nPrevious Day High=%.5f", dayHigh(UTC,1));
}It throws some IDX error, LookBack seems insufficient but when I explicitly set it, it seems never enough.
Also, the statements after "TimeFrame=96" don't seem to execute once every 24 hours.
"dayHigh" doesn't really fetch the correct price of the previous day.
Very frustrating...
Guys, I really don't understand how this works. Have a look at the following code:
function run()
{
BarPeriod = 15;
TimeFrame = 1;
// do something every M15 barTimeFrame = 96;
printf("\nPrevious Day High=%.5f", dayHigh(UTC,1));
}
It throws some IDX error, LookBack seems insufficient but when I explicitly set it, it seems never enough.
Also, the statements after "TimeFrame=96" don't seem to execute once every 24 hours.
"dayHigh" doesn't really fetch the correct price of the previous day.
Very frustrating...
Quote from Mustafa Durmaz on December 29, 2024, 8:40 pmHi, sorry for the late response.
Looked at your first script, you did not use Dayhigh/daylow function. These function use the markethours (if not defined usually 9:30 to 16:00). You can define them by using Startmarket and Endmarket. And dont use Timeframe>1 within run function. Normally you create a separate function before run with different timeframe, and then call this separate function within run, after calling the function you can/must set timeframe back to 1, otherwise the following variables/functions will stuck in the called timeframe. Look into zorro Workshop 6 for how to use timeframe.
Now Example for dayhigh/-low:
function run()
{
BarPeriod = 15;
StartMarket = 0015; // start at 00:15 , the time you Set here should be dividable through barperiod
EndMarket = 2345; // i close market at 23:45, so dayhigh and daylow will be checked between 00:15 and 23:45, you can change as you need
var High = dayHigh(UTC,1); // gives highest price in UTC Timezone from yesterday (1)
var Low = dayLow(UTC,1); // ... and the lowest.
plot("High",High,MAIN,RED);
plot("Low",Low,0,GREEN); // with These plot commands you will see TODAY the dayhigh and daylow of YESTERDAY on your chart. Also the values of high and low can be used accordingly. If you want to plot TODAYs High and low so far, that would be a different approach. But first try that code ...
Hi, sorry for the late response.
Looked at your first script, you did not use Dayhigh/daylow function. These function use the markethours (if not defined usually 9:30 to 16:00). You can define them by using Startmarket and Endmarket. And dont use Timeframe>1 within run function. Normally you create a separate function before run with different timeframe, and then call this separate function within run, after calling the function you can/must set timeframe back to 1, otherwise the following variables/functions will stuck in the called timeframe. Look into zorro Workshop 6 for how to use timeframe.
Now Example for dayhigh/-low:
function run()
{
BarPeriod = 15;
StartMarket = 0015; // start at 00:15 , the time you Set here should be dividable through barperiod
EndMarket = 2345; // i close market at 23:45, so dayhigh and daylow will be checked between 00:15 and 23:45, you can change as you need
var High = dayHigh(UTC,1); // gives highest price in UTC Timezone from yesterday (1)
var Low = dayLow(UTC,1); // ... and the lowest.
plot("High",High,MAIN,RED);
plot("Low",Low,0,GREEN); // with These plot commands you will see TODAY the dayhigh and daylow of YESTERDAY on your chart. Also the values of high and low can be used accordingly. If you want to plot TODAYs High and low so far, that would be a different approach. But first try that code ...
Quote from Mustafa Durmaz on December 29, 2024, 8:48 pmQuote from fxsurgeon on December 3, 2024, 3:13 amThank you Algo Mike for the explanation and the example.
How about fetching D1 price information (say current Day High and Low) at a certain time of the day? In which function should this happen?
Uploaded related screenshot ...
Quote from fxsurgeon on December 3, 2024, 3:13 amThank you Algo Mike for the explanation and the example.
How about fetching D1 price information (say current Day High and Low) at a certain time of the day? In which function should this happen?
Uploaded related screenshot ...
Uploaded files: