SMA with Stochastic Filter
Author: traindl
Creation Date: 6/21/2012 6:09 AM
profile picture

traindl

#1
Hi Eugene,

i have again some troubles creating a strategies code.
My strategie should buy at market if SMA(20days) is above SMA (50) then i would even like to enter position when Indicator(stochastic) is smaller then 23 BUT strategie should also buy at market if SMA(20days) is below SMA(50) but then i will go only in position (buy at market) if indicator (stochastic) is smaller then 17.

so to say if we are in a uptrend i would by earlier (if stoch falls under 23) and if we are in a downtrend i would buy with more attention (if stoch falls under 17)

exit is always after 3 days at end of day.

how can i code this manually ?

hope you can help me .. .

cheers thomas
profile picture

Cone

#2
Hi Thomas, please post what you've got and then we can point out where you've gone wrong. At least for me I learn best from my mistakes!
profile picture

Eugene

#3
Hi Thomas,

Although both Cone and yours truly could spit out this code with eyes shut, the following excercise might prove beneficial for your learning curve. Start with the rule wizard's output: add an entry, drop all conditions (choose from Stochastic and General Indicators > "Indicator is below an Indicator"), drop an OR divider between the two related groups, add an exit, and you're all set. Click "Open code in new Strategy window" and examine the output. It would not be as terse as human-created code, but makes possible to instantly visualize your ideas in code. If something requires modification, fire away with questions.