How would i code an EMA 3 with a 1 bar horizontal shift and a 0.034 verticle shift?
JSParticipant
Veteran
y = ExponentialAverage[3](close[1]) + 0.034
Return y
thanks, and if i wanted a verticle shift down would it be
ExponentialAverage[3](close[1]) – 0.034 ?
also does return y needed to be coded underneith? if i was coding using ema3 as the name should it be this…
ema3 = ExponentialAverage[3](close[1]) + 0.034
return ema3
JSParticipant
Veteran
True, plus (+) is a positive vertical shift and minus (-) is a negative vertical shift.
You can use any name you want.
thanks, is it necessary to put “return ema3” under the line?
JSParticipant
Veteran
An indicator must be closed with RETURN
Return EMA3 will show the values of the EMA3 in the graph.
Thanks, I have done this:
ema3 = ExponentialAverage[3](close[1]) + 0.034
return ema3
and the return is underlined red showing an error
JSParticipant
Veteran
Do you use the above line in an automatic trading system?
JSParticipant
Veteran
Example Trading System with EMA3
EMA3Plus = ExponentialAverage[3](close[1]) + 0.034
EMA3Min = ExponentialAverage[3](close[1]) – 0.034
If Close Crosses Over EMA3Plus then
Buy 1 contract at market
ElsIf Close Crosses Under EMA3Min then
SellShort 1 contract at market
EndIf
Graph EMA3Plus as “EMA3Plus”
Graph EMA3Min as “EMA3Min”
yes its is to detect conditions for one line bing over the other by a set distance. I have the code i’m just looking to find the correct way to set up the verticle and horizontal shift. The return was new to me but showed up as an error when i tried to implement
JSParticipant
Veteran
Have you already optimized your system?
Yeh I’m just experimenting with different ways of setting up the averages
moi j’aimerais pouvoir déplacer horizontalement un indicateur quelconque vers la gauche ou la droite
I would like to be able to horizontally move any indicator to the left or to the right
@
MIKE PAPY
Only post in the
language of the forum that you are posting in. For example English only in the English speaking forums and French only in the French speaking forums.
Please abide by the rules highlighted in yellow (below).
Thank you 🙂
With RETURN you can only move the indicator to the left, i.e. the past value is plotted currently (not in the future, though), such as:
Sma = Average[20,0](close)
RETURN Sma[1]
you cam shift both ways using graphic instructions (DrawSegment) by:
– repainting current data into the past
– plotting cuurrent data into the future.
In any case each indicator must be programmed to behave this way.