Классный индикатор сигналит, когда акция обновила свой максимум или минимум.
Сценарий применения:
Сделать таблицу 4 на 4 и получать сигналы при обновлении
экстремумов у выбраных акций.
input marketOpen = 930;
input marketClose = 1600;
input intraDaySpan = {Default «SameDay», «OverNight»};
def OpenCounter = SecondsFromTime(marketOpen);
def CloseCounter = SecondsTillTime(marketClose);
def MarketHours = if OpenCounter >= 0 and CloseCounter >= 0 then 1 else 0;
def beforeMidnight = OpenCounter >= 0 and CloseCounter <= 0;
def afterMidnight = OpenCounter <= 0 and CloseCounter >= 0;
def Today ;
def hideChartBubbles ;
rec DailyHigh ;
rec DailyLow ;
switch (intraDaySpan) {
case «SameDay»:
Today = if GetDay() != GetDay()[1] then 1 else 0;
DailyHigh = if Today then high else if MarketHours then if high > DailyHigh[1] then high else DailyHigh[1] else high;
DailyLow = if Today then low else if MarketHours then if low < DailyLow[1] then low else DailyLow[1] else low;
hideChartBubbles = MarketHours;
case «OverNight»:
Today = 0;
DailyHigh = if Today then high else if beforeMidnight or afterMidnight then if high > DailyHigh[1] then high else DailyHigh[1] else high;
DailyLow = if Today then low else if beforeMidnight or afterMidnight then if low < DailyLow[1] then low else DailyLow[1] else low;
hideChartBubbles = beforeMidnight or afterMidnight;
};
AddLabel(close > 0, Concat( «Dly High: », DailyHigh), Color.GRAY);
AddLabel(close > 0, Concat( «Dly Low: », DailyLow), Color.GRAY);
plot TodaysHigh = DailyHigh;
plot TodaysLow = DailyLow;
TodaysHigh.SetDefaultColor(Color.GREEN);
TodaysLow.SetDefaultColor(Color.RED);
AddChartBubble(DailyHigh > DailyHigh[1] and hideChartBubbles, DailyHigh, «Hi», color.GREEN, yes);
AddChartBubble(DailyLow < DailyLow[1] and hideChartBubbles, DailyLow, «Lo», color.RED, no);
Alert(DailyHigh > DailyHigh[1] and hideChartBubbles, «New High», Alert.BAR, Sound.RING);
Alert(DailyLow < DailyLow[1] and hideChartBubbles, «New Low», Alert.BAR, Sound.RING);plot Data = close;
Полная библиотека полезных индикаторов для NYSE (Ccылка)