PowerOfStocks_5EMA For ThinkOrSwim

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Very popular Indian strategy 5 ema trading view

PowerOfStocks_5EMA - #BANKNIFTY TradingView
https://in.tradingview.com/script/0cUu6m0O-PowerOfStocks-5EMA/0cUu6m0O@ suryakiran @ apex trader @ sam800 can you convert this Indian game changer 5 ema strategy many videos available Hindi and English can you make scanner also and watchlist
Thank you all genius coder
try this

CSS:
#//𝒦𝑒𝒶𝓃𝓊_𝑅𝒾𝒯𝓏 PowerOfStocks_5EMA Code Start - Keanu_RiTz//
#// This source code is subject to the terms of the Mozilla Public License 2.0 at ht
#// © Keanu_ritz
#indicator(title='PowerOfStocks_5EMA_-_𝒦𝑒𝒶𝓃𝓊_𝑅𝒾𝒯𝓏', overlay=true)
# Converted by Sam4Cok@Samer800    - 10 / 2023
input MovAvgType = AverageType.EXPONENTIAL;
input source = close;
input movAvgLength = 5;
input EnableExtraStoplossShownBelow = no;    # "Enable the Extra SL shown below"
input NumberOfPointsBelowLowOrAboveHigh = 5; # 'Value to set SL number of points below-low or above-high'
input RiskToRewardRatio = 3;                 # 'Risk to Reward Ratio'
input ShowSellSignals = yes;                 # 'Show Sell Signals'
input ShowBuySignals = no;                   # 'Show Buy Signals'
input tradeWithExtraCondition = no;

def na = Double.NaN;
def last = isNaN(Close);
def Eusl = EnableExtraStoplossShownBelow;
def usl = NumberOfPointsBelowLowOrAboveHigh;
def BSWCon = tradeWithExtraCondition;
def RiRe = RiskToRewardRatio;
def ema5 = MovingAverage(MovAvgType, source, movAvgLength);

plot pema5 = ema5;#, '5 Ema'
pema5.SetDefaultColor(Color.CYAN);

def shortC;
def ssl;
def star;
def lsl;
def ltar;
def ltarhitC;
def longC;
def sslhitC;
def starhitC;
def lslhitC;
def sellat;
def lssl;
def starl;
def lstar;
def lsell;
def lssllbl;
def lstarlbl;
def lselllbl;

def ShortWC = low[1] > ema5[1] and low[1] > low and shortC[1] == 0 and close < close[1];
def ShortWOC = low[1] > ema5[1] and low[1] > low and shortC[1] == 0;
def Short = if BSWCon then ShortWC else ShortWOC;
def sslhit = high > ssl[1] and shortC[1] > 0 and sslhitC[1] == 0;
def starhit = low < star[1] and shortC[1] > 0 and starhitC[1] == 0;
def LongWC =  high[1] < ema5[1] and high[1] < high and longC[1] == 0 and close > close[1];
def LongWOC =  high[1] < ema5[1] and high[1] < high and longC[1] == 0;
def Long = if BSWCon then LongWC else LongWOC;
def lslhit = low < lsl[1] and longC[1] > 0 and lslhitC[1] == 0;
def ltarhit = high > ltar[1] and longC[1] > 0 and ltarhitC[1] == 0;


if Short and ShowSellSignals {
    shortC = shortC[1] + 1;
    sslhitC = 0;
    starhitC = 0;
    if Eusl {
        ssl = high[1] + usl;
        starl = if BSWCon then ((high[1] - source) + usl) * RiRe else ((high[1] - low[1]) + usl) * RiRe;
    } else {
        ssl = high[1];
        starl = if BSWCon then (high[1] - source) * RiRe else (high[1] - low[1]) * RiRe;
    }
    star = if BSWCon then source - starl else low[1] - starl;
    sellat = if BSWCon then source else low[1];
    lssl = ssl;
    lstar = star;
    lsell = sellat;
    lssllbl = ssl;
    lstarlbl = star;
    lselllbl = sellat;
} else {
    ssl = ssl[1];
    starl = starl[1];
    star = star[1];
    sellat = sellat[1];
    lssl = lssl[1];
    lstar = lstar[1];
    lsell = lsell[1];
    lssllbl = na;
    lstarlbl = na;
    lselllbl = na;
    if sslhit == no and starhit == no and shortC[1] > 0 {
        shortC = shortC[1];
        sslhitC = 0;
        starhitC = 0;
    } else {
        if sslhit {
            shortC = 0;
            sslhitC = sslhitC[1] + 1;
            starhitC = starhitC[1];
        } else
        if starhit {
            shortC = 0;
            starhitC = starhitC[1] + 1;
            sslhitC = sslhitC[1];
        } else {
            shortC = shortC[1];
            starhitC = starhitC[1];
            sslhitC = sslhitC[1];
        }
    }
}
def ltarl;def buyat;def llsl;def lltar;def lbuy;
def llsllbl;def lltarlbl;def lbuylbl;
if Long and ShowBuySignals {
    longC = longC[1] + 1;
    lslhitC = 0;
    ltarhitC = 0;
    if Eusl {
        lsl = low[1] - usl;
        ltarl = if BSWCon then ((source - low[1]) + usl) * RiRe else ((high[1] - low[1]) + usl) * RiRe;
    } else {
        lsl = low[1];
        ltarl = if BSWCon then (source - low[1]) * RiRe else (high[1] - low[1]) * RiRe;
    }
    ltar = if BSWCon then source + ltarl else high[1] + ltarl;
    buyat = if BSWCon then source else high[1];
    llsl = lsl;
    lltar = ltar;
    lbuy = buyat;
    llsllbl = lsl;
    lltarlbl = ltar;
    lbuylbl = buyat;
} else {
    lsl = lsl[1];
    ltarl = ltarl[1];
    ltar = ltar[1];
    buyat = buyat[1];
    llsl = llsl[1];
    lltar = lltar[1];
    lbuy = lbuy[1];
    llsllbl = na;
    lltarlbl = na;
    lbuylbl = na;
if lslhit == no and ltarhit == no and longC[1] > 0 {
    longC = longC[1];
    lslhitC = 0;
    ltarhitC = 0;
    } else {
    if lslhit {
        longC = 0;
        lslhitC = lslhitC[1] + 1;
        ltarhitC = ltarhitC[1];
    } else
        if ltarhit {
            longC = 0;
            ltarhitC = ltarhitC[1] + 1;
            lslhitC = lslhitC[1];
    } else {
            longC = longC[1];
            ltarhitC = ltarhitC[1];
            lslhitC = lslhitC[1];
    }
}}

AddChartBubble(lbuylbl, low, "B", Color.GREEN, no);
AddChartBubble(lselllbl, high, "S", Color.RED);


plot lssl1  = if !last and lssl then lssl else na;
plot lstar1 = if !last and lstar then lstar else na;
plot lsell1 = if !last and lsell then lsell else na;

plot llsl1  = if !last and llsl then llsl else na;
plot lltar1 = if !last and lltar then lltar else na;
plot lbuy1  = if !last and lbuy then lbuy else na;

lssl1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
lstar1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
lsell1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

llsl1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
lltar1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
lbuy1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

lssl1.SetDefaultColor(Color.DARK_RED);
lstar1.SetDefaultColor(Color.DARK_GREEN);
lsell1.SetDefaultColor(Color.GRAY);

llsl1.SetDefaultColor(Color.DARK_RED);
lltar1.SetDefaultColor(Color.DARK_GREEN);
lbuy1.SetDefaultColor(Color.GRAY);

#-- END of CODE
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
354 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top