Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Quad, aliswee), 835 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Can't plot daily high & low #478375
10/09/19 17:35
10/09/19 17:35
Joined: Oct 2019
Posts: 3
V
vivaldi2 Offline OP
Guest
vivaldi2  Offline OP
Guest
V

Joined: Oct 2019
Posts: 3
I am trying to plot yesterday high and low, but it return something different :
Code
function run()
{
	
	BarPeriod = 30;
	LookBack  = 0;
	
	
	asset("EUR/USD");
	

	
var session_high = dayHigh(UTC,1); //
var session_low = dayLow(UTC,1); // 
var session_pivot1 = dayPivot(UTC,1); // 


plot("USUTC-1 Session High Price", session_high, MAIN, GREEN); 
plot("USUTC-2 Session Low Price", session_low, MAIN, GREEN); 
plot("USUTC-3 Session Pivot", session_pivot1, MAIN, YELLOW); 

}

what is wrong with my code ?

Re: Can't plot daily high & low [Re: vivaldi2] #478379
10/10/19 08:56
10/10/19 08:56
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
Code looks ok, what is wrong with the plot?

Re: Can't plot daily high & low [Re: vivaldi2] #478381
10/10/19 13:49
10/10/19 13:49
Joined: Oct 2019
Posts: 3
V
vivaldi2 Offline OP
Guest
vivaldi2  Offline OP
Guest
V

Joined: Oct 2019
Posts: 3
Look at the screenshot, the high and low of yesterday ( green lines ) is not true .

Attached Files Screenshot 2019-10-10 17.16.15.png
Re: Can't plot daily high & low [Re: vivaldi2] #478384
10/11/19 11:04
10/11/19 11:04
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
Why is it not true?

Re: Can't plot daily high & low [Re: vivaldi2] #478398
10/13/19 16:16
10/13/19 16:16
Joined: Oct 2019
Posts: 2
toronto
J
Junker Offline
Guest
Junker  Offline
Guest
J

Joined: Oct 2019
Posts: 2
toronto
I agree with @vivaldi2. i am learning this now and i used the same formula but applied to 1 minute and in ET timezone.
my understanding of dayLow is that it gets the yesterday's lowest price of the day and dayHigh gets the yesterdays highest price for the day.

The day high seems to be working properly. but the day low is not.

[Linked Image]

formula i used is as below
Code
function run()
{
	
	BarPeriod = 1;
	LookBack  = 0;
	
	
	asset("EUR/USD");
	

	
var session_high = dayHigh(ET,1); //
var session_low = dayLow(ET,1); // 
var session_pivot1 = dayPivot(ET,1); // 


plot("USUTC-1 Session High Price", session_high, MAIN, GREEN); 
plot("USUTC-2 Session Low Price", session_low, MAIN, GREEN); 
plot("USUTC-3 Session Pivot", session_pivot1, MAIN, YELLOW); 

}

Re: Can't plot daily high & low [Re: vivaldi2] #478399
10/13/19 20:04
10/13/19 20:04
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Why did you set your lookback to 0 when your indicator is looking back?

Re: Can't plot daily high & low [Re: vivaldi2] #478400
10/13/19 23:51
10/13/19 23:51
Joined: Oct 2019
Posts: 2
toronto
J
Junker Offline
Guest
Junker  Offline
Guest
J

Joined: Oct 2019
Posts: 2
toronto
i took away @vivaldi2 thread. so cannot comment.
However, i removed the lookback and still get the same result.

my guess is that this formula is ignoring prices before 9.30 EST which is the US trading hours. How can i make it look at 24 hour charts x 5 days as the forex works that way?

[Linked Image]

Code
function run()
{
	
	BarPeriod = 30;

	
	asset("EUR/USD");
	

	
var session_high = dayHigh(ET,1); //
var session_low = dayLow(ET,1); // 
var session_pivot1 = dayPivot(ET,1); // 


plot("USUTC-1 Session High Price", session_high, MAIN, GREEN); 
plot("USUTC-2 Session Low Price", session_low, MAIN, GREEN); 
plot("USUTC-3 Session Pivot", session_pivot1, MAIN, YELLOW); 

}

Re: Can't plot daily high & low [Re: vivaldi2] #478401
10/14/19 13:52
10/14/19 13:52
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
It's not a day. It's a market day. Read the manual. Forex has sessions, but I don't think it has a "daily high & low".

Re: Can't plot daily high & low [Re: vivaldi2] #478407
10/14/19 18:39
10/14/19 18:39
Joined: Jul 2017
Posts: 783
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 783
You have to set Start/EndMarket explicitly to the times you need, or Zorro will use default values. You better do it for most of the vars yourself, not to waste time debugging unexpected results.

Doing this, you should keep in mind that:

1) Start/EndMarket are in "local market time" (while vars like StartWeek/EndWeek and Zorro's internal time are UTC)
2) setting StartMarket>EndMarket (e.g. start:1705- end:1700) which is the case for FX and futures - will not work out of the box. You will have to code around.

3) values you specify in these vars are EXCLUSIVE of that time, i.e. setting EndMarket=1700 will NOT include the bar ending 1700.

4) StartWeek/EndWeek work in 1hr increments.

Re: Can't plot daily high & low [Re: vivaldi2] #478457
10/24/19 02:01
10/24/19 02:01
Joined: Aug 2019
Posts: 22
F
felixfx Offline
Newbie
felixfx  Offline
Newbie
F

Joined: Aug 2019
Posts: 22
this is how I would personally do it if you're plotting a rolling high and low of the day:

function run()
{

BarPeriod = 30; // you're using 30 minutes
vars Close = priceClose();

int period = 48; // 30 minutes * 48 is 24 hours
vars high = series(MaxVal(Close, period);
vars low = series(MinVal(Close, period);

plot("high", high, MAIN, BLUE);
plot("low", low, MAIN, RED);

}


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1