Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/29/2004(UTC) Posts: 1,394 Location: Glastonbury, CT
Was thanked: 2 time(s) in 2 post(s)
|
salvo, a system will come down to a binary form of an expression +1 for a long position, -1 for a short position and 0 for when you are not in a trade. In the expert advisor , you could use the trend ribbon for this by defining a bullish condition for a long position, and the bearish condition for a short position.
in the bullish box enter
Trend:={If(your definition of
uptrend,1,If(your definition of down trend,-1,0));}
Trailing
Stop:={If(trend -1,your long trailing stop,If(trend=-1,your short
trailing stop,C));}
Long:={entry condition} and {Trend is up}and {C
is greater than or equal to the Trailing Stop};
Short:={entry
condition} and {Trend is down} and {C is less than or equal to the
Trailing Stop};
signal:=long-short;
Signal=1
in the bearish box enter
Trend:={If(your definition of
uptrend,1,If(your definition of down trend,-1,0));}
Trailing
Stop:={If(trend -1,your long trailing stop,If(trend=-1,your short
trailing stop,C));}
Long:={entry condition} and {Trend is up}and {C
is greater than or equal to the Trailing Stop};
Short:={entry
condition} and {Trend is down} and {C is less than or equal to the
Trailing Stop};
signal:=long-short;
signal=-1
now for the example in a system tester using the so called system that I described before
you have a basic indicator crossing a threshold line, a system that is
always long or short .
if you are trying to trade with a trend,
add a trend filter to your system.
to protect your gains add a
trailing stop to your position
Trend:={If(your definition of
uptrend,1,If(your definition of down trend,-1,0));} Trailing
Stop:={If(trend -1,your long trailing stop,If(trend=-1,your short
trailing stop,C));} Long:={entry condition} and {Trend is up}and {C
is greater than or equal to the Trailing Stop}; Short:={entry
condition} and {Trend is down} and {C is less than or equal to the
Trailing Stop}; signal:=long-short;
a long entry will be
signal = 1 and Ref(Signal,-1) is less than 1 a long exit will be
signal = 0 and Ref(Signal,-1) = 1 a short entry will be signal =-1
and Ref(Signal,-1) is greater than -1 a short exit will be signal
=0 and Ref(Signal,-1) =-1
in the buy order tab enter a formula {your long entry}
Trend:={If(your definition of
uptrend,1,If(your definition of down trend,-1,0));}
Trailing
Stop:={If(trend -1,your long trailing stop,If(trend=-1,your short
trailing stop,C));}
Long:={entry condition} and {Trend is up}and {C
is greater than or equal to the Trailing Stop};
Short:={entry
condition} and {Trend is down} and {C is less than or equal to the
Trailing Stop};
signal:=long-short; signal = 1 and Ref(Signal,-1) is less than 1
in the sell order tab enter a formula {your long exit}
Trend:={If(your definition of
uptrend,1,If(your definition of down trend,-1,0));}
Trailing
Stop:={If(trend -1,your long trailing stop,If(trend=-1,your short
trailing stop,C));}
Long:={entry condition} and {Trend is up}and {C
is greater than or equal to the Trailing Stop};
Short:={entry
condition} and {Trend is down} and {C is less than or equal to the
Trailing Stop};
signal:=long-short; signal = 0 and Ref(Signal,-1) = 1
in the sell short tab enter a formula{your short entry}
Trend:={If(your definition of
uptrend,1,If(your definition of down trend,-1,0));}
Trailing
Stop:={If(trend -1,your long trailing stop,If(trend=-1,your short
trailing stop,C));}
Long:={entry condition} and {Trend is up}and {C
is greater than or equal to the Trailing Stop};
Short:={entry
condition} and {Trend is down} and {C is less than or equal to the
Trailing Stop};
signal:=long-short; signal = -1 and Ref(Signal,-1) is greater than -1
in the buy to cover tab enter a formula{your short exit}
Trend:={If(your definition of
uptrend,1,If(your definition of down trend,-1,0));}
Trailing
Stop:={If(trend -1,your long trailing stop,If(trend=-1,your short
trailing stop,C));}
Long:={entry condition} and {Trend is up}and {C
is greater than or equal to the Trailing Stop};
Short:={entry
condition} and {Trend is down} and {C is less than or equal to the
Trailing Stop};
signal:=long-short;
signal = 0 and Ref(Signal,-1) =-1
You can use the same formulas from the system tester tabs in the expert advisor to create signals to display on a chart
Again you have to determine the conditions and fill in the blanks and change some of the written symbols into > = and so forth due to web site errors some of the symbols don't appear correctly in this forum
|