Plot an arrow when price is over / under 8 day EMA?

IAMDOV

New member
Hi everyone. I am quite new to this Thinkscript stuff. I am looking to see if anyone can help me create or point me in the right direction for this Thinkscript.

I would like an Up Arrow plotted on the candle when the Price is 3 or more dollars BELOW the 8-day EMA.
and a Down Arrow plotted on the candle when is it 3 or more dollars ABOVE the 8-day EMA.

I am a scalp / intraday trader. I am normally on the 1 minute and 5 minute chart.

Thank you to anyone who can help in advanced :)
 
Last edited by a moderator:

rad14733

Well-known member
VIP
What you are looking for has nothing to do with the 8 days you referenced, only the 1 and 5 minutes... They don't use an 8 day aggregate... Anyhoo...!!! You want a plot on your charts, or do you really want a scanner...??? And how far back do you want to look, 1 bar, 5 bars...???
 

IAMDOV

New member
I am looking for a plot or some type of indication (Preferably the up and down arrows) on my chart. As far as how far back i would like for it to work in real time if possible. If you mean like how how far back i can see the arrows i guess 30 days is sufficient.
 

rad14733

Well-known member
VIP
I am looking for a plot or some type of indication (Preferably the up and down arrows) on my chart. As far as how far back i would like for it to work in real time if possible. If you mean like how how far back i can see the arrows i guess 30 days is sufficient.
Ok... So you use an 8EMA on your charts and want an arrow when the price is over $3 below average... Should be doable... Hold that thought...
 

XeoNoX

Well-known member
VIP
do you litterly mean 8-day EMA or 8EMA??

the differenece is one is plotted against the daily timefraime and the other is plotted against your current charting timeframe... i would assume you mean 8EMA but i may be incorrect, you will have to specify.
 

IAMDOV

New member
I am talking about plotting against my current charting timeframe. So for example i want to be on the 5 minute chart of a stock and have an up arrow appear beneath the candle if it is 3 or more dollars beneath the 8EMA.
 

IAMDOV

New member
@rad14733 Thanks so much for this! I edited some stuff for this turns out +/- 3.50 works best for my strategy. I didn't now how to combine the Up arrow code with the down arrow code in one thinkscript so I ended up making 2 separate ones. One for the buying indicator and one for the seller indicator. Is it possible to have these thinkscripts work under a condition? like lets say the RSI has to be Above 65 or below 35?
 

XeoNoX

Well-known member
VIP
Thanks so much for this! I edited some stuff for this turns out +/- 3.50 works best for my strategy. I didnt now how to combine the Up arrow code with the down arrow code in one thinkscript so i ended up making 2 separate ones. One for the buying indicator and one for the seller indicator. Is it possible to have these thinkscripts work under a condition? like lets say the RSI has to be Above 65 or below 35?
yes you just make a scan that scans for RSI above 60. that can be made easily from within thinkorswim desktop platforms scan wizard.
 

IAMDOV

New member
yes you just make a scan that scans for RSI above 60. that can be made easily from within thinkorswim desktop platforms scan wizard.
Thanks for the reply. I do know how to make the scanner for RSI. But i am talking about adding it into the thinkscript. For example i only want those arrows now to appear above / below the candles when the RSI is above / below certain points. Is that possible? I feel like that would be an "IF condition" just not sure how to add it in.
 

XeoNoX

Well-known member
VIP
You can just make the RSI scan in the wizard and then add it to your existing code like this:

vu8XgDi.png


I just copied it from the wizard and pasted it into the code with the correct formatting and gave it a reference/syntax of "rsi_low". you can name it whatever you want.

Code:
def less_than_ma_minus_3 = close is less than or equal to MovAvgExponential("length" = 8)."AvgExp" - 3.00;
def rsi_low = RSI()."RSI" is less than 35 ;
plot data = rsi_low and less_than_ma_minus_3;
Data.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

or if its easier maybe this makes more sense:

Code:
def scan1 = close is less than or equal to MovAvgExponential("length" = 8)."AvgExp" - 3.00;
def scan2 = RSI()."RSI" is less than 35 ;
plot FINALSCAN = scan1 and scan2;
FINALSCAN.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

learn the wizard and you can keep adding more scans.
 
Last edited:

Similar threads

Top