Hi,
in easylanguage, how can i have the low's average of all hourly bars for each day?
With the code below,
i have error "Unknown Function" with Hour(time)
here is the code
If D > D[1] Then Value1 = 1
Else
If Hour( Time ) <> Hour( Time )[1] Then Value1 = Value1 + 1;
Value2 = Average( Low, Value1 );
Plot1( Value2 );
thank you for your help
Nuno
Low's Average of All Hourly Bars for Each Day -- code help
-
- Posts: 174
- Joined: 31 Jan 2006
- Has thanked: 74 times
- Been thanked: 5 times
Nuno ... try this. But it's an easy way and it's in 60min intr-day charts only.
Hope this is what you wanted.
Kind regards.
Mike
Input : P1(High), P2(Low), Show_PrevHALA(1);
Vars : HC(0), LC(0), HA(0), LA(0), PHA(0), PLA(0);
Vars : BarsSinceLastReset(0);
If Bartype < 2 then begin
if IsSess1FirstBar then
BarsSinceLastReset = 0;
HC = 0;
LC = 0;
end;
BarsSinceLastReset = BarsSinceLastReset + 1;
If BarsSinceLastReset = 0 then begin
HC = 0;
LC = 0;
End;
If Date > Date[1] then PHA = HA[1];
If Date > Date[1] then PLA = LA[1];
If Date <> Date[1] then begin
PHA = HA[1];
PLA = LA[1];
End;
If BarsSinceLastReset >= 2 and BarsSinceLastReset > BarsSinceLastReset[1]then begin
HC = HC[1] + P1[1];
LC = LC[1] + P2[1];
HA = HC/BarsSinceLastReset[1];
LA = LC/BarsSinceLastReset[1];
Plot1(HA, "HighAvg", Red);
Plot2(LA, "LowAvg", Blue);
End;
If Show_PrevHALA = 1 then begin
Plot3(PHA, "PrevHA", Magenta);
Plot4(PLA, "PrevLA", Cyan);
End;
Hope this is what you wanted.
Kind regards.
Mike
- Attachments
-
- Avg_High_Low_60min.png
- (33.01 KiB) Downloaded 629 times
-
- Posts: 174
- Joined: 31 Jan 2006
- Has thanked: 74 times
- Been thanked: 5 times
- TJ
- Posts: 7745
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Function : IsSess1FirstBar
Kind regards.
Mike
Sorry. I forgot to post it.var:
answer(false),
barStartTime(0);
if BarNumber = 1 then
answer = true
else if Sess2StartTime = Sess2EndTime then
{ no session 2, e.g. stocks }
answer = date <> date[1]
else begin
{ there is a session 2, e.g. E-Mini }
barStartTime = CalcTime(Time,-BarInterval);
if barStartTime = Sess1StartTime then
answer = true
else if barStartTime > Sess1StartTime then
answer = false
else begin
answer = Time > Sess1StartTime;
end;
end;
IsSess1FirstBar = answer;
Kind regards.
Mike
-
- Posts: 174
- Joined: 31 Jan 2006
- Has thanked: 74 times
- Been thanked: 5 times
No Problem at all ... do you use these two levels as a support/resitance fro the next day ? I thought it could/should be a good idea and coded the levels for the averages for hourly high/low for the previous day. Then I saw that in more then 80% we have HL for the day in this zone from the previous day.
Can you tell me what your idea is/ or was to get this zone in your chart ? Would be interesting . Thx.
Mike
Can you tell me what your idea is/ or was to get this zone in your chart ? Would be interesting . Thx.
Mike
-
- Posts: 174
- Joined: 31 Jan 2006
- Has thanked: 74 times
- Been thanked: 5 times