and just like that MACD KISS/Stochastic setup - I know a few of
you guys code or try to - why not try to code that strategy up?
I've given enough parameters for you to set up the rules, see if
you can get something working - good exercise if you want to get
into this stuff and develop your own stuff
I took a shot at trying to code this into a Short Strategy. It
works, but not great results. Maybe someone in the community can
take a look and make a reccomendation?
If Condition1 and Condition2 and Condition3 and Condition4
and Condition5 and Condition6 Then sell short next bar at market;
if PositionBasis then
SetStopPosition
else
SetStopShare;
if MarketPosition = -1 then Begin
SetProfitTarget( Amount );
SetStopLoss( Amount1 );
If MACDDiff>=0.05 Then Buy to cover next bar at market;
End;
some obvious issues: 1. entries should be stop orders set 1 tick
below or above the candle, these are triggering on the open of a
candle. The stop loss is also trigging on the open of candlesticks
vs at a set stop point. Stops should be above the current or last
candle for shorts, and below for longs
but you have to realize that while the MACD KISS/Stoch 5
strategy is quite a simple strategy, when trying to put it to
actual code to be automated it up it gets a lot more complicated
than you think. There's a lot of variables that you need to try and
define that you don't think about when you subjectively trade
it
For example: do you trigger off the high or low of any
candlestick or do you try to limit those candles to dojis, candles
with small bodies only, and if you do, you now have to define your
settings for what a doji is, such as how big of a % of candle range
do you allow the body to be, things like that. Or do you try to
limit candles that are too large etc
The Stochastic getting overbought or oversold - do you limit it
to >=80% for overbought, or do you have the condition start to
be counted if the Stochastic is say 65% or higher, the same for
when it's oversold, do you force it to be below 20%, or higher?
Also do you try and define filters for the MACD and Stochastic.
For example: if the MACD lines crossed 5 bars ago or 10 bars ago,
20 bars ago, do you set some kind of limit threshold. Also, many
times MACD lines just barely cross and then reverse, so do you
require that the MACD lines have not touched or do you give it some
wiggle room, and if so how much
the 5 length Stochastic - do you add a filter where it had
recycled from oversold to overbought for the short within X number
of bars? Same for longs? Basically trying to add a condition so
that if the Stochastic is just osculating in a middle range maybe
those signals don't work as well as if the stochastic had moved
from overbought to oversold or oversold to overbought
also the profit targets and stops: What to use for a profit
target? a 1:1 risk/reward target? a 2:1, a 3:1? Or Stochastic to
get from overbought to oversold or from oversold to overbought?
And what if that doesn't occur, what's your other exit?
What's your stop also, and how does it adjust
again -I want to show you guys that even very simple strategies
get much more complex when you actually code them because
everything has to be defined, and exact. Things that you don't even
think about or consider when subjectively trading the setup, will
prove to have dramatic results in a coded strategy
point being - it's very complicated when actually trying to code
something like this
I have staring the arduous task of writing it up, marking up
detailed examples for James - it's a pain in the ass, which is why
I haven't finished it before. To really get it right and something
that works, I have to think of every little thing and be
detailed
Posted by bulf6285 on 10th of Mar 2023 at 11:55 am
Matt, if you and James would do a weekend webinar on this topic,
I'd pay to be a part that! Adding filters, etc is not something I
have been able to do very well. Just a thought, not sure how the
rest of the BPT community feels.
and just like that MACD
MACD KISS/Stochastic OS example again - 10 min chart for educational
Posted by matt on 8th of Mar 2023 at 04:13 pm
and just like that MACD KISS/Stochastic setup - I know a few of you guys code or try to - why not try to code that strategy up? I've given enough parameters for you to set up the rules, see if you can get something working - good exercise if you want to get into this stuff and develop your own stuff
I took a shot at
Posted by bulf6285 on 9th of Mar 2023 at 08:17 pm
I took a shot at trying to code this into a Short Strategy. It works, but not great results. Maybe someone in the community can take a look and make a reccomendation?
Heres the code:
inputs:
StochLength1( 60 ),
StochLength2( 5 ),
StochOverbought (75),
StochLevel( 50 ),
FastLength( 12 ),
SlowLength( 26 ),
MACDLength( 9 ),
Amount( 10 ),
Amount1(5),
PositionBasis( false );
variables:
ReturnValue1( 0 ),
oFastK1( 0 ),
oFastD1( 0 ),
oSlowK1( 0 ),
oSlowD1( 0 ),
ReturnValue2( 0 ),
oFastK2( 0 ),
oFastD2( 0 ),
oSlowK2( 0 ),
oSlowD2( 0 ),
MyMACD( 0 ),
MACDAvg( 0 ),
MACDDiff( 0 ),
Price( Close );
ReturnValue1 = Stochastic( H, L, C, StochLength1, 3, 3, 1, oFastK1, oFastD1, oSlowK1,
oSlowD1 );
ReturnValue2 = Stochastic( H, L, C, StochLength2, 3, 3, 1, oFastK2, oFastD2, oSlowK2,
oSlowD2 );
MyMACD = MACD( Close, FastLength, SlowLength );
MACDAvg = XAverage( MyMACD, MACDLength );
MACDDiff = MyMACD - MACDAvg;
Condition1 = oSlowk1<50;
Condition2 = oSlowk2>StochOverbought;
Condition3 = MyMACD>MyMACD[1];
Condition4 = MACDDiff<0;
Condition5 = MACDDiff<0;
Condition6 = MACDDiff[1]<0;
If Condition1 and Condition2 and Condition3 and Condition4 and Condition5 and Condition6 Then sell short next bar at market;
if PositionBasis then
SetStopPosition
else
SetStopShare;
if MarketPosition = -1 then Begin
SetProfitTarget( Amount );
SetStopLoss( Amount1 );
If MACDDiff>=0.05 Then Buy to cover next bar at market;
End;
bulf6285. Love this. Motivating for
Posted by DigiNomad on 9th of Mar 2023 at 10:14 pm
bulf6285. Love this. Motivating for me as well. I'll poke around this weekend and see what I can see in terms of potentially contributing. Thanks!
nice to see one of
Posted by matt on 9th of Mar 2023 at 08:57 pm
nice to see one of you guys attempt it!
some obvious issues: 1. entries should be stop orders set 1 tick below or above the candle, these are triggering on the open of a candle. The stop loss is also trigging on the open of candlesticks vs at a set stop point. Stops should be above the current or last candle for shorts, and below for longs
but you have to realize that while the MACD KISS/Stoch 5 strategy is quite a simple strategy, when trying to put it to actual code to be automated it up it gets a lot more complicated than you think. There's a lot of variables that you need to try and define that you don't think about when you subjectively trade it
For example: do you trigger off the high or low of any candlestick or do you try to limit those candles to dojis, candles with small bodies only, and if you do, you now have to define your settings for what a doji is, such as how big of a % of candle range do you allow the body to be, things like that. Or do you try to limit candles that are too large etc
The Stochastic getting overbought or oversold - do you limit it to >=80% for overbought, or do you have the condition start to be counted if the Stochastic is say 65% or higher, the same for when it's oversold, do you force it to be below 20%, or higher?
Also do you try and define filters for the MACD and Stochastic. For example: if the MACD lines crossed 5 bars ago or 10 bars ago, 20 bars ago, do you set some kind of limit threshold. Also, many times MACD lines just barely cross and then reverse, so do you require that the MACD lines have not touched or do you give it some wiggle room, and if so how much
the 5 length Stochastic - do you add a filter where it had recycled from oversold to overbought for the short within X number of bars? Same for longs? Basically trying to add a condition so that if the Stochastic is just osculating in a middle range maybe those signals don't work as well as if the stochastic had moved from overbought to oversold or oversold to overbought
also the profit targets and stops: What to use for a profit target? a 1:1 risk/reward target? a 2:1, a 3:1? Or Stochastic to get from overbought to oversold or from oversold to overbought? And what if that doesn't occur, what's your other exit? What's your stop also, and how does it adjust
again -I want to show you guys that even very simple strategies get much more complex when you actually code them because everything has to be defined, and exact. Things that you don't even think about or consider when subjectively trading the setup, will prove to have dramatic results in a coded strategy
point being - it's very complicated when actually trying to code something like this
Sweet! This is a great
Posted by DigiNomad on 9th of Mar 2023 at 10:12 pm
Sweet! This is a great starting point for improving the code. Copied to clipboard. Thanks!
You can say that again
Posted by bulf6285 on 9th of Mar 2023 at 09:09 pm
You can say that again :)
This was after god knows how many iterations and still not right.
Can't imagine what the system trade codes must look like.
I have staring the arduous
Posted by matt on 9th of Mar 2023 at 09:16 pm
I have staring the arduous task of writing it up, marking up detailed examples for James - it's a pain in the ass, which is why I haven't finished it before. To really get it right and something that works, I have to think of every little thing and be detailed
Matt, if you and James
Posted by bulf6285 on 10th of Mar 2023 at 11:55 am
Matt, if you and James would do a weekend webinar on this topic, I'd pay to be a part that! Adding filters, etc is not something I have been able to do very well. Just a thought, not sure how the rest of the BPT community feels.
for fun here's a writeup
Posted by matt on 10th of Mar 2023 at 01:15 pm
for fun here's a writeup I gave James to try and start coding this: This one goes over the conditions for a short trigger, with filters, targets etc
Less is more
Posted by watcdy on 9th of Mar 2023 at 09:55 pm
Less is more