Gamestudio Links
Zorro Links
Newest Posts
Suppressing Messages
by MatPed. 11/18/19 14:19
Indicator and TimeFrame
by jcl. 11/18/19 12:44
Sierra Chart Plugin
by AndrewAMD. 11/17/19 19:27
Programming a megaproject in python and R
by anonymous87. 11/17/19 12:56
Pyramid
by MatPed. 11/16/19 16:14
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
9 registered members (AndrewAMD, kvm, Dooley, tnktnns, jenGs, 3run, Ayumi, 2 invisible), 656 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
anonymous87, LaszloK, gra9, Dev_ill, Ryu
18330 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: 865
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 865
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
Re: Can't plot daily high & low [Re: vivaldi2] #478384
10/11/19 11:04
10/11/19 11:04
Joined: Sep 2003
Posts: 865
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 865
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: 791
Chicago
AndrewAMD Online
User
AndrewAMD  Online
User

Joined: Feb 2017
Posts: 791
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,055
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,055
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: 408
Z
Zheka Offline
Senior Member
Zheka  Offline
Senior Member
Z

Joined: Jul 2017
Posts: 408
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: 17
F
felixfx Offline
Newbie
felixfx  Offline
Newbie
F

Joined: Aug 2019
Posts: 17
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);

}


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