When i put into my Metastock 9.1 Pro for E-Signal in the Indicator Builder to a New Formula Creation the:
--->Start--->
Days:=Cum(1);
DaysLoaded:=LastValue(Days);
DaysRemaining:=DaysLoaded-Days;
StartOfMonth:=(Month()>Ref(Month(),-1))
OR (Month()=1 AND Ref(Month(),-1)=12);
Months:=Cum(StartOfMonth);
MonthsLoaded:=LastValue(Months);
MonThsRemaining:=MonthsLoaded-Months;
EndOfMonth:=(Month()<Ref(Month(),1))
OR (Month()=12 AND Ref(Month(),1)=1);
HighDaysAgo:=If(EndOfMonth,HighestSinceBars(1,StartOfMonth,HIGH),0);
LastHigh:=LastValue(HighestSinceBars(1,StartOfMonth,HIGH));
LowDaysAgo:=If(EndOfMonth,LowestSinceBars(1,StartOfMonth,LOW),0);
LastLow:=LastValue(LowestSinceBars(1,StartOfMonth,LOW));
DaysPassed:=BarsSince(StartOfMonth);
LastDay:=LastValue(DaysPassed);
DaysLeftInMonth:=If(MonthsRemaining>0,
LastValue(ValueWhen(LastValue(MonthsRemaining+PREV-PREV),
Endofmonth,DaysPassed)),LastDay)-DaysPassed;
currenthigh:=If(MonthsRemaining>0,
LastValue(ValueWhen(LastValue(MonthsRemaining+PREV-PREV),
EndOfMonth,HighDaysAgo)),LastHigh);
currentLow:=If(MonthsRemaining>0,
LastValue(ValueWhen(LastValue(MonthsRemaining+PREV-PREV),
EndOfMonth,LowDaysAgo)),LastLow);
HighDay:=If(DaysLeftInMonth=Currenthigh,1,0);
LowDay:=If(DaysLeftInMonth=CurrentLow,-1,0);
HighDay;
LowDay;
<---End<---
I received the Message: This constant is being used incorrectly
But when put the above Formula in the same Field without the
--->Start--->
and
<---End<---
meaning:
Days:=Cum(1);
DaysLoaded:=LastValue(Days);
DaysRemaining:=DaysLoaded-Days;
StartOfMonth:=(Month()>Ref(Month(),-1))
OR (Month()=1 AND Ref(Month(),-1)=12);
Months:=Cum(StartOfMonth);
MonthsLoaded:=LastValue(Months);
MonThsRemaining:=MonthsLoaded-Months;
EndOfMonth:=(Month()<Ref(Month(),1))
OR (Month()=12 AND Ref(Month(),1)=1);
HighDaysAgo:=If(EndOfMonth,HighestSinceBars(1,StartOfMonth,HIGH),0);
LastHigh:=LastValue(HighestSinceBars(1,StartOfMonth,HIGH));
LowDaysAgo:=If(EndOfMonth,LowestSinceBars(1,StartOfMonth,LOW),0);
LastLow:=LastValue(LowestSinceBars(1,StartOfMonth,LOW));
DaysPassed:=BarsSince(StartOfMonth);
LastDay:=LastValue(DaysPassed);
DaysLeftInMonth:=If(MonthsRemaining>0,
LastValue(ValueWhen(LastValue(MonthsRemaining+PREV-PREV),
Endofmonth,DaysPassed)),LastDay)-DaysPassed;
currenthigh:=If(MonthsRemaining>0,
LastValue(ValueWhen(LastValue(MonthsRemaining+PREV-PREV),
EndOfMonth,HighDaysAgo)),LastHigh);
currentLow:=If(MonthsRemaining>0,
LastValue(ValueWhen(LastValue(MonthsRemaining+PREV-PREV),
EndOfMonth,LowDaysAgo)),LastLow);
HighDay:=If(DaysLeftInMonth=Currenthigh,1,0);
LowDay:=If(DaysLeftInMonth=CurrentLow,-1,0);
HighDay;
LowDay;
work well.
Do you have opinion for that?
George K.