SetBarsRequired( 1000 );
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
/*+------------------------------------------------------------------+
| calculate Monthly Highest By TimeFrameCompress and TimeFrameExpand |
+--------------------------------------------------------------------+*/
TimeFrameSet( inMonthly );
currentMonthlyHighestHighValue = HHV( H, 1 );
TimeFrameRestore();
expandedCurrentMonthlyHighestHighValue = TimeFrameExpand( currentMonthlyHighestHighValue, inMonthly, expandLast );
Plot( expandedCurrentMonthlyHighestHighValue , "expandedCurrentMonthlyHighestHighValue", colorRed, styleDots + styleNoLine );
/*+-----------------------------------------------------------+
| calculate the Expected Monthly Highest only for controlling |
+-------------------------------------------------------------+*/
newMonth = Month() != Ref(Month(),-1);
expectedMonthlyHighest = HHV( H , BarsSince(newMonth) + 1);
Plot( expectedMonthlyHighest , "expectedMonthlyHighest", colorGreen, styleDots + styleNoLine );
/*+--------+
| ERROR??? |
+----------+*/
errorBetweenExpandedAndExpectedHighest = expandedCurrentMonthlyHighestHighValue - expectedMonthlyHighest;
/*+--------+
| Plotting |
+----------+*/
Plot( C, "Close", IIf( newMonth , colorOrange , colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
Plot( errorBetweenExpandedAndExpectedHighest , "errorBetweenExpandedAndExpectedHighest", colorYellow , styleHistogram );
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
/*+------------------------------------------------------------------+
| calculate Monthly Highest By TimeFrameCompress and TimeFrameExpand |
+--------------------------------------------------------------------+*/
TimeFrameSet( inMonthly );
currentMonthlyHighestHighValue = HHV( H, 1 );
TimeFrameRestore();
expandedCurrentMonthlyHighestHighValue = TimeFrameExpand( currentMonthlyHighestHighValue, inMonthly, expandLast );
Plot( expandedCurrentMonthlyHighestHighValue , "expandedCurrentMonthlyHighestHighValue", colorRed, styleDots + styleNoLine );
/*+-----------------------------------------------------------+
| calculate the Expected Monthly Highest only for controlling |
+-------------------------------------------------------------+*/
newMonth = Month() != Ref(Month(),-1);
expectedMonthlyHighest = HHV( H , BarsSince(newMonth) + 1);
Plot( expectedMonthlyHighest , "expectedMonthlyHighest", colorGreen, styleDots + styleNoLine );
/*+--------+
| ERROR??? |
+----------+*/
errorBetweenExpandedAndExpectedHighest = expandedCurrentMonthlyHighestHighValue - expectedMonthlyHighest;
/*+--------+
| Plotting |
+----------+*/
Plot( C, "Close", IIf( newMonth , colorOrange , colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
Plot( errorBetweenExpandedAndExpectedHighest , "errorBetweenExpandedAndExpectedHighest", colorYellow , styleHistogram );