since quite a long time I'm trading the very simple strategie described below discretionary and it works very well. Unfortunately I don't reach to wright the strategie on that way, that signals are only given, if MA 20 is rising or descending and MACD has to be positiv or crossing over the MA 20 for LE, and inverse for SE.
Positions are protected by a SL and a percent TrailingStopp 20% (this, because the SL is different from one instrument to an other. SL = 1.5 bricks).
Is there anyone who want to help me to do the script correctly?
Strategie
LongEntry:
Condition1 - Close over MA 20
Condition2 - MACD (crosses or is positiv) over MA 20 (in Masterchart)
Condition3 - MA 20 is rising
ShortEntry:
Inversed
Code Long:
Code: Select all
inputs: Price( Close ), Length( 20 ), ConfirmBars( 1 ), //MA
FastLength( 12 ), SlowLength( 26 ), MACDLength( 9 ) ; //MACD
variables: var0( 0 ), //MA
var1( 0 ), var2( 0 ) ; //MACD
var1 = MACD( Close, FastLength, SlowLength ) ;
var2 = XAverage( var1, MACDLength ) ;
condition1 = Price > AverageFC( Price, Length ) and CurrentBar > 2 and var1 > var2 ;
if condition1 then
var0 = var0 + 1
else
var0 = 0 ;
condition1 = CurrentBar > ConfirmBars and var0 = ConfirmBars ;
if condition1 then
Buy ( "LE" ) next bar at market ;
Code: Select all
inputs: Price( Close ), Length( 20 ), ConfirmBars( 1 ), //MA
FastLength( 12 ), SlowLength( 26 ), MACDLength( 9 ) ; //MACD
variables: var0( 0 ), //MA
var1( 0 ), var2( 0 ) ; //MACD
var1 = MACD( Close, FastLength, SlowLength ) ;
var2 = XAverage( var1, MACDLength ) ;
condition1 = Price < AverageFC( Price, Length ) and CurrentBar > 2 and var1 < var2 ;
if condition1 then
var0 = var0 + 1
else
var0 = 0 ;
condition1 = CurrentBar > ConfirmBars and var0 = ConfirmBars ;
if condition1 then
Sellshort ( "SE" ) next bar at market ;
Rigitti