LeoParticipant
Veteran
Hi all,
I am having a problem in a code.
I would like to shown certain values of daily timeframe in a short time frame.
The variable as input is DAYS
Here the code, it produce an error of an infinite loop which I don’t get why.
//DAILY VALUES FOR INTRADAY
//Author: LEO
//Variable as input: DAYS
once DayAverage=Dclose(1)
once DAYCLOSE=Dclose(1)
once TYPICALDAY=Dclose(1)
once DAYHIGHER=Dhigh(1)
once DAYLOWER=Dlow(1)
IF INTRADAYBARINDEX=2 THEN
DayAverage=0
FOR i=1 to DAYS DO
DayAverage=DCLOSE(i)+DayAverage
NEXT
DayAverage=DayAverage/DAYS
DAYHIGHER=highest[DAYS](Dhigh(1))
DAYLOWER=lowest[DAYS](Dlow(1))
DAYCLOSE=Dclose(1)
TYPICALDAY=(DHIGH(1)+DLOW(1)+DCLOSE(1))/3
ENDIF
return DayAverage as "Day Close Average", DAYCLOSE as "Yesterday Close", TYPICALDAY as "YesterdTypical Price", DAYHIGHER as "Minimum day", DAYLOWER as "Maximum Day"
At a guess I would say that it is because DAYS is a potentially ever moving variable so in the middle of the loop it could add another day on before it is finished the loop and so the possibility is that the loop could never end. Plus DAYS is the total number of days since 1900 and so you will never reach the end of the loop because you won’t have enough bars on a chart to test that.
LeoParticipant
Veteran
Wow! “days” is function in ProRealTime. in my computer Mac it always appear in color black like just a variable .
Now it works. I will posted in the library then
Wow! “days” is function in ProRealTime. in my computer Mac it always appear in color black like just a variable .
I did think it was strange that you were trying to use it! You should report the colour issue on Mac’s to PRT so they might fix it to avoid future confusion for others.