You are on page 1of 2

// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.

0
International (CC BY-NC-SA 4.0)
https://creativecommons.org/licenses/by-nc-sa/4.0/

// © Zeiierman

//Copyright by Zeiierman.
//The information contained in my scripts/indicators/ideas does not constitute
financial advice or a solicitation to buy or sell any securities of any type.
//I will not accept liability for any loss or damage, including without
limitation any loss of profit, which may arise directly or indirectly from use
of or reliance on such information.
//All investments involve risk, and the past performance of a security,
industry, sector, market, financial product, trading strategy, or individual’s
trading does not guarantee future results or returns.
//Investors are fully responsible for any investment decisions they make. Such
decisions should be based solely on an evaluation of their financial
circumstances, investment objectives, risk tolerance, and liquidity needs.
//My scripts/indicators/ideas are only for educational purposes!

//@version=4
study("GreedZone indicator ", overlay=true, shorttitle="GreedZone (Expo)")

source = input(ohlc4, title="Source", group="Source")


Low_period = input(30, title="Low Period", group="GreedZone Settings")
Stdev_period = input(50, title="Stdev Period", group="GreedZone Settings")

WMA = input(false, title="Use WMA instead of SMA?", group="Average Type")

// Condition One
FZ1 = (lowest(source,Low_period) - source)/lowest(source,Low_period)
AVG1 = sma(FZ1,Stdev_period)

if WMA
    AVG1 := wma(FZ1,Stdev_period)
   
STDEV1 = stdev(FZ1,Stdev_period)
FZ1Limit = AVG1-STDEV1

// Condition Two
FZ2 = sma(source, Low_period)
AVG2 = sma(FZ2, Stdev_period)

if WMA
    FZ2 := wma(source, Low_period)
    AVG2 := wma(FZ2, Stdev_period)
   
   
STDEV2 = stdev(FZ2, Stdev_period)
FZ2Limit = AVG2+STDEV2

// GreedZone
Greedzone_Con = FZ1 < FZ1Limit and FZ2 > FZ2Limit
GreedZoneOpen = Greedzone_Con? low+tr:na
GreedZoneClose = Greedzone_Con? low+2*tr:na

plotcandle(GreedZoneOpen,GreedZoneOpen,GreedZoneClose,GreedZoneClose,
color=#90EE90, bordercolor=color.green,  title="GreedZone Candlesticks")

// Alerts
AlertCircle = input(true, title="Show Alert Circle?", group="Alerts")
Alert_Col =  Greedzone_Con != Greedzone_Con[1] and AlertCircle? #90EE90 : na
plotshape(Greedzone_Con, style=shape.circle, location=location.abovebar,
size=size.tiny, color=Alert_Col, title="Alert Circle")
alertcondition(Greedzone_Con != Greedzone_Con[1], title='GreedZone',
message='GreedZone')

You might also like