This is my first post, so bear with me. I have pulled parts of this code info from Lazy Bear - Scalper's Channel (I believe), but I am trying to modify it and can't seem to figure out how to get what I want; if it's even possible.
1. I am trying to make the "Daily High" line stay at the Current Daily High until there is a new Daily High and not go lower. Currently, it will only look back at the previous 20 bars.
2. Want the "Daily Low" line to start at the market open and do the same as the "Daily High" just for the Low.
3. Want the "Scalper Line" to start at market open and be calculated by ((Daily High - Daily Low) * 0.5) + Daily Low. I'm pretty sure I have the portion correct, I just can't get it to start at the market open instead of 20 bars back.
I assume I need to add some sort of YYYYMMDD or GetDay() function I just don't know how to incorporate that into the code and I've searched and played around for about 4 days now trying to figure that out. Any help would be greatly appreciated.
1. I am trying to make the "Daily High" line stay at the Current Daily High until there is a new Daily High and not go lower. Currently, it will only look back at the previous 20 bars.
2. Want the "Daily Low" line to start at the market open and do the same as the "Daily High" just for the Low.
3. Want the "Scalper Line" to start at market open and be calculated by ((Daily High - Daily Low) * 0.5) + Daily Low. I'm pretty sure I have the portion correct, I just can't get it to start at the market open instead of 20 bars back.
I assume I need to add some sort of YYYYMMDD or GetDay() function I just don't know how to incorporate that into the code and I've searched and played around for about 4 days now trying to figure that out. Any help would be greatly appreciated.
Code:
declare hide_on_daily;
input Length = 20;
## Daily/Previous Day High/Low ##
#-------------------------------------------------------#
def DayHigh = Highest(data = HIGH, Length);
def PrevDayHigh = DailyHighLow();
def DayLow = Lowest(data = LOW, Length);
def PrevDayLow = DailyHighLow().DailyLow;
plot dh = DayHigh;
dh.SetDefaultColor(color = Color.GREEN);
plot pdh = PrevDayHigh;
pdh.SetDefaultColor(color = Color.DARK_GREEN);
pdh.SetPaintingStrategy(paintingStrategy = PaintingStrategy.DASHES);
plot dl = DayLow;
dl.SetDefaultColor(color = Color.RED);
plot pdl = PrevDayLow;
pdl.SetDefaultColor(color = Color.DARK_RED);
pdl.SetPaintingStrategy(paintingStrategy = PaintingStrategy.DASHES);
## Scalper Line ##
#-------------------------------------------------------#
def DayHighScalper = Highest(data = HIGH);
def DayLowScalper = Lowest(data = LOW);
def dhs = DayHighScalper;
def dls = DayLowScalper;
plot Scalper_Line = ((dhs-dls)*.5)+dls;
Scalper_Line.SetDefaultColor(color.YELLOW);
Last edited by a moderator: