Moving Average Angle (Stochastic)
The system buys long when it gives the first buy signal (green).
The system closes long when it gives the first close signal (red).
Thank!!!
You could start with something like this:
//Calculate angle of MA
MAPeriod = 40
SamplePeriod = 5
AngleThreshold = 45
MA = average[MAPeriod](close)
MAAngle = (sin(atan((MA-MA[1])/MA[1]*100)))*1000//R2[MAPeriod](close)*100
AverageAngle = Average[SamplePeriod](MAAngle)
AverageAngle2 = Average[round(SamplePeriod/2)](MAAngle)
If AverageAngle > AngleThreshold Then
buy 1 contract at market
endif
If AverageAngle < (AngleThreshold*-1) Then
sellshort 1 contract at market
EndIf
It is not the Nonethless idea.
The system is long only.
And you should only buy a position when the indicator is green.
And sell the position when the indicator is red.
I put some black bars on the graph.
The first is where you should buy the long, when the indicator turns green.
Then he would give another signal to buy long, but since he has already bought the previous signal, he skips it.
Finally close the long when the indicator turns red, at the second black bar.
not tested:
MAPeriod = 40
SamplePeriod = 5
AngleThreshold = 45
MA = average[MAPeriod](close)
MAAngle = (sin(atan((MA-MA[1])/MA[1]*100)))*1000//R2[MAPeriod](close)*100
AverageAngle = Average[SamplePeriod](MAAngle)
AverageAngle2 = Average[round(SamplePeriod/2)](MAAngle)
If notonmarket and AverageAngle > AngleThreshold Then
buy 1 contract at market
endif
If AverageAngle < (AngleThreshold*-1) Then
sell at market
EndIf
Perfect!!!
Now all you need to do is pick the colour of your Ferrari 😬
P.S make sure you press Thanks for his time 👍