I am wondering why this code is running in TS2000i, while Multicharts compiles with an error. Can you help me?
{ *****************************************************************************************
System : Volatility Expansion
This system is provided as part of the Omega Research System Library Club.
For information on the club and other Omega Research educational services,
please call 800-422-8587 or 305-551-9991
*******************************************************************************************}
Input: LMult(1.2), SMult(1.8), ProfitPt(0), TrailBar(4);
Vars: BuyLevel(0), SellLevel(0);
{ Entry Orders }
Buy at Open next bar + Average(Range,4) * LMult Stop;
Sell at Open next bar - Average(Range,4) * SMult Stop;
{ Exit at first Profitable Open }
If MarketPosition = 1 and Open next bar > EntryPrice + ProfitPt + Commission * CurrentContracts / BigPointValue then
ExitLong ("Long Profit")next bar at Open;
If MarketPosition = -1 and Open next bar < EntryPrice - ProfitPt - Commission * CurrentContracts / BigPointValue then
ExitShort ("Short Profit") next bar at Open;
{ Trailing Stops }
If MarketPosition = 1 then
ExitLong next bar at Lowest( Low , TrailBar ) Stop;
If MarketPosition =-1 then
ExitShort next bar at Highest( High , TrailBar ) Stop;
{ Stale Position Exit }
If BarsSinceEntry > 4 AND PositionProfit < 500 then Begin
ExitLong ("Long Too Long") next bar at Market;
ExitShort ("Short Too Longt") next bar at Market;
End;
Volatility Expansion System: Compiled with errors
-
- Posts: 60
- Joined: 21 Dec 2007
- Has thanked: 3 times
- Been thanked: 9 times
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007
Dear Helmut,
Omega research still uses old EasyLanguage syntax. If you try to use the code you posted in TS 8 it won't get compiled. However, after a number of transformations bringing the code above in accordance with the new syntax rules, it will work both in TS and in MultiCharts.
Please see the modified code below.
Regards.
[LegacyColorValue = true];
{ *****************************************************************************************
System : Volatility Expansion
This system is provided as part of the Omega Research System Library Club.
For information on the club and other Omega Research educational services,
please call 800-422-8587 or 305-551-9991
*******************************************************************************************}
Input: LMult(1.2), SMult(1.8 ), ProfitPt(0), TrailBar(4);
Vars: BuyLevel(0), SellLevel(0);
{ Entry Orders }
Buy Next Bar at Open next bar + Average(Range,4) * LMult Stop;
Sell Next Bar at Open next bar - Average(Range,4) * SMult Stop;
{ Exit at first Profitable Open }
If MarketPosition = 1 and Open next bar > EntryPrice + ProfitPt + Commission * CurrentContracts / BigPointValue then
Sell ("Long Profit")next bar at Open;
If MarketPosition = -1 and Open next bar < EntryPrice - ProfitPt - Commission * CurrentContracts / BigPointValue then
Buy to Cover ("Short Profit") next bar at Open;
{ Trailing Stops }
If MarketPosition = 1 then
Sell next bar at Lowest( Low , TrailBar ) Stop;
If MarketPosition =-1 then
Buy to Cover next bar at Highest( High , TrailBar ) Stop;
{ Stale Position Exit }
If BarsSinceEntry > 4 AND PositionProfit < 500 then Begin
Sell ("Long Too Long") next bar at Market;
Buy to Cover ("Short Too Longt") next bar at Market;
End;
Omega research still uses old EasyLanguage syntax. If you try to use the code you posted in TS 8 it won't get compiled. However, after a number of transformations bringing the code above in accordance with the new syntax rules, it will work both in TS and in MultiCharts.
Please see the modified code below.
Regards.
[LegacyColorValue = true];
{ *****************************************************************************************
System : Volatility Expansion
This system is provided as part of the Omega Research System Library Club.
For information on the club and other Omega Research educational services,
please call 800-422-8587 or 305-551-9991
*******************************************************************************************}
Input: LMult(1.2), SMult(1.8 ), ProfitPt(0), TrailBar(4);
Vars: BuyLevel(0), SellLevel(0);
{ Entry Orders }
Buy Next Bar at Open next bar + Average(Range,4) * LMult Stop;
Sell Next Bar at Open next bar - Average(Range,4) * SMult Stop;
{ Exit at first Profitable Open }
If MarketPosition = 1 and Open next bar > EntryPrice + ProfitPt + Commission * CurrentContracts / BigPointValue then
Sell ("Long Profit")next bar at Open;
If MarketPosition = -1 and Open next bar < EntryPrice - ProfitPt - Commission * CurrentContracts / BigPointValue then
Buy to Cover ("Short Profit") next bar at Open;
{ Trailing Stops }
If MarketPosition = 1 then
Sell next bar at Lowest( Low , TrailBar ) Stop;
If MarketPosition =-1 then
Buy to Cover next bar at Highest( High , TrailBar ) Stop;
{ Stale Position Exit }
If BarsSinceEntry > 4 AND PositionProfit < 500 then Begin
Sell ("Long Too Long") next bar at Market;
Buy to Cover ("Short Too Longt") next bar at Market;
End;
-
- Posts: 60
- Joined: 21 Dec 2007
- Has thanked: 3 times
- Been thanked: 9 times
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007