Hello,
I am trying to make a script, for when a MACD crosses over and then, enter a trailing stop, do I just copy the settraiingstop script into the MACD LE / SE script and it shall work?
Thanks
MACD Crossover Signal, and then Trailing Stop. [SOLVED]
- Stan Bokov
- Posts: 963
- Joined: 18 Dec 2009
- Has thanked: 367 times
- Been thanked: 302 times
Re: MACD Crossover Signal, and then Trailing Stop. [SOLVED]
Yeah, you can do that in the full MC, but not in MCDT. Basically you'll need to incorporate the trailing stop into the MACD signals, just like you said. Make sure you test your scripts so that you see they are working ok before you trade though.
Re: MACD Crossover Signal, and then Trailing Stop.
Hi there,
Maybe I have put this in the wrong forum bit, but yes I am using just Multi Charts, NOT the DT.
Here is the code, but I do not think that the trailingstop is working:
inputs: FastLength( 12 ), SlowLength( 26 ), MACDLength( 9 ) ;
variables: var0( 0 ), var1( 0 ), var2( 0 ) ;
var0 = MACD( Close, FastLength, SlowLength ) ;
var1 = XAverage( var0, MACDLength ) ;
var2 = var0 - var1 ;
condition1 = CurrentBar > 2 and var2 crosses over 0 ;
if condition1 then
Buy ( "MacdLE" ) this bar at market ;
[IntrabarOrderGeneration = false]
inputs: PositionBasis( false ), Amount( 1 ) ;
if PositionBasis then
SetStopPosition
else
SetStopShare ;
SetDollarTrailing( 10 ) ;
inputs: FastLength( 12 ), SlowLength( 26 ), MACDLength( 9 ) ;
variables: var0( 0 ), var1( 0 ), var2( 0 ) ;
var0 = MACD( Close, FastLength, SlowLength ) ;
var1 = XAverage( var0, MACDLength ) ;
var2 = var0 - var1 ;
condition1 = CurrentBar > 2 and var2 crosses under 0 ;
if condition1 then
Sell Short ( "MacdSE" ) this bar at market ;
[IntrabarOrderGeneration = false]
inputs: PositionBasis( false ), Amount( 1 ) ;
if PositionBasis then
SetStopPosition
else
SetStopShare ;
SetDollarTrailing( 10 ) ;
Maybe I have put this in the wrong forum bit, but yes I am using just Multi Charts, NOT the DT.
Here is the code, but I do not think that the trailingstop is working:
inputs: FastLength( 12 ), SlowLength( 26 ), MACDLength( 9 ) ;
variables: var0( 0 ), var1( 0 ), var2( 0 ) ;
var0 = MACD( Close, FastLength, SlowLength ) ;
var1 = XAverage( var0, MACDLength ) ;
var2 = var0 - var1 ;
condition1 = CurrentBar > 2 and var2 crosses over 0 ;
if condition1 then
Buy ( "MacdLE" ) this bar at market ;
[IntrabarOrderGeneration = false]
inputs: PositionBasis( false ), Amount( 1 ) ;
if PositionBasis then
SetStopPosition
else
SetStopShare ;
SetDollarTrailing( 10 ) ;
inputs: FastLength( 12 ), SlowLength( 26 ), MACDLength( 9 ) ;
variables: var0( 0 ), var1( 0 ), var2( 0 ) ;
var0 = MACD( Close, FastLength, SlowLength ) ;
var1 = XAverage( var0, MACDLength ) ;
var2 = var0 - var1 ;
condition1 = CurrentBar > 2 and var2 crosses under 0 ;
if condition1 then
Sell Short ( "MacdSE" ) this bar at market ;
[IntrabarOrderGeneration = false]
inputs: PositionBasis( false ), Amount( 1 ) ;
if PositionBasis then
SetStopPosition
else
SetStopShare ;
SetDollarTrailing( 10 ) ;
- TJ
- Posts: 7745
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: MACD Crossover Signal, and then Trailing Stop.
Please use code tag when posting codes. It makes reading codes easier.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: MACD Crossover Signal, and then Trailing Stop.
Please provide us addition information regarding the issue.
What do you mean by "I do not think that the trailingstop is working" ?
Is the order sent with the incorrect price or it is not sent at all?
Who is the data feed and what are the symbol settings in the QUote manager?
Please attach a screenshot of the settings tab.
What autotrading mode do you use (sync or async)?
Who is your broker?
What do you mean by "I do not think that the trailingstop is working" ?
Is the order sent with the incorrect price or it is not sent at all?
Who is the data feed and what are the symbol settings in the QUote manager?
Please attach a screenshot of the settings tab.
What autotrading mode do you use (sync or async)?
Who is your broker?