nordicbeast
New member
Hello.
I have been utilizing DeepSeek, and gone through several iterations to create this custom study. It is intended for scalping stocks on the 1min time frame.
What it does:
Triggers a LONG entry plot when:
What are the remaining issues:
It works like expected: signals are plotted on the chart, mental stoploss lines etc. But, the refresh is not working. I can get new plots on the chart by changing between different tickers, or reapplying studies. Is this a limitation of ToS? I have tried so many different queries for DeepSeek, but we just seem to not be able to solve this challenge.
I have been utilizing DeepSeek, and gone through several iterations to create this custom study. It is intended for scalping stocks on the 1min time frame.
What it does:
Triggers a LONG entry plot when:
- Green Candle: close > open (current candle closes higher than it opens).
- New High: high > high[1] (current candle’s high exceeds the previous candle’s high).
- Stop Line Breach: low crosses below low[1] (price breaks below the prior candle’s low).
- Red Candle with Lower Low:
- low < low[1] (current candle’s low is lower than the previous candle’s low).
- close < open (red candle).
- Static Stop Loss:
- Set at the prior candle’s low (low[1]) when the entry is triggered.
- Example: If you enter at $100, and the prior candle’s low was $99, the stop is fixed at $99.
- Stop Updates:
- Remains active until the trade is exited.
- Resets to NaN (not a number) after exiting.
What are the remaining issues:
It works like expected: signals are plotted on the chart, mental stoploss lines etc. But, the refresh is not working. I can get new plots on the chart by changing between different tickers, or reapplying studies. Is this a limitation of ToS? I have tried so many different queries for DeepSeek, but we just seem to not be able to solve this challenge.
Code:
# SCALPER INDICATOR (TOS-COMPATIBLE REFRESH)
declare once_per_bar;
input showEntries = yes;
input showExits = yes;
# REFRESH TRIGGER (Works on ALL Charts)
def updateTrigger = Close + Volume() + GetTime(); # Valid ToS functions only
plot f = updateTrigger;
f.Hide();
# --- YOUR ORIGINAL STRATEGY LOGIC BELOW ---
def greenCandle = close > open;
def newHigh = high > high[1];
def validEntry = newHigh and greenCandle;
def stopLineBreach = low crosses below low[1];
def redCandleLowerLow = low < low[1] and close < open;
def inPosition;
def stopLevel;
if BarNumber() == 1 {
inPosition = 0;
stopLevel = Double.NaN;
} else {
inPosition = if validEntry and !inPosition[1] then 1
else if (stopLineBreach or redCandleLowerLow) and inPosition[1] then 0
else inPosition[1];
stopLevel = if validEntry and !inPosition[1] then low[1]
else if (stopLineBreach or redCandleLowerLow) and inPosition[1] then Double.NaN
else stopLevel[1];
}
# VISUAL ELEMENTS
plot EntrySignal = if showEntries and validEntry and !inPosition[1] then low else Double.NaN;
EntrySignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
EntrySignal.SetDefaultColor(Color.WHITE);
plot ExitSignal = if showExits and ((stopLineBreach or redCandleLowerLow) and inPosition[1]) then high else Double.NaN;
ExitSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
ExitSignal.SetDefaultColor(Color.CYAN);
plot StopLine = if inPosition then stopLevel else Double.NaN;
StopLine.SetDefaultColor(Color.WHITE);
StopLine.SetStyle(Curve.SHORT_DASH);
Last edited by a moderator: