Login Page - Create Account

Support Board


Date/Time: Sun, 09 Feb 2025 03:53:03 +0000



Convert writing for sierra chart study

View Count: 807

[2020-08-04 18:51:52]
User628616 - Posts: 132
I have this Indicator that I use on another platform and was wondering how to convert it to work with SC. It plots a Arrow(Up/Down) each time the market makes a New High/Low for the Day(RTH)
Here is the Indicator writing:


input marketOpen = 930;

input marketClose = 1615;

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);

AddLabel(close > 0, Concat("Range: " , (DailyHigh - DailyLow) / TickSize()), Color.GRAY);

plot TodaysHigh = DailyHigh;

plot TodaysLow = DailyLow;

TodaysHigh.SetDefaultColor(Color.GREEN);

TodaysLow.SetDefaultColor(Color.RED);



plot downsignal = (DailyHigh > DailyHigh[1] and hideChartBubbles);

downsignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

plot upsignal = (DailyLow < DailyLow[1] and hideChartBubbles);

upsignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Alert(DailyHigh > DailyHigh[1] and hideChartBubbles, "New High", Alert.BAR, Sound.NoSound);

Alert(DailyLow < DailyLow[1] and hideChartBubbles, "New Low", Alert.BAR, Sound.NoSound);

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account