IncludeSystem - Replaced in PowerLanguage with?

Questions about MultiCharts and user contributed studies.
Chip4Pips
Posts: 7
Joined: 27 Nov 2013
Has thanked: 2 times
Been thanked: 1 time

IncludeSystem - Replaced in PowerLanguage with?

Postby Chip4Pips » 25 May 2015

I have recently been updating the code of some old easyLanguage systems so that I can run and test and modify them using MultiCharts. Usually the fixes are simple; however, I can't seem to figure out how to replace the old easyLanguage 'IncludeSystem' syntax in PowerLanguage. I have tried substituting 'IncludeStrategy' and 'IncludeSignal' to no avail. I am including the troublesome code below:

Code: Select all

{STAD13: LinReg - Mom}

[LegacyColorValue = TRUE];

Inputs:
Price(Close), Regress(20), XMALen(15), MomLen(10), EntryPct(.25),
EntryCnt(4), BigProfs(8), ExitBars(4), BKeven(3), Protect(3), Trailing(5), Volatile(3), Length(10);
Variables:
XLRAverage(0), Moment(0), BuySetup(False), SellSetup(False), BuyPrice(0), SellPrice(0),
LongCounter(0), ShortCounter(0), ATR(0);

XLRAverage = XAverage(LinearRegValue(Price, Regress, 0), XMALen);
Moment = Momentum(Price, MomLen);
ATR = AvgTrueRange(10);

LongCounter = LongCounter + 1;
ShortCounter = ShortCounter + 1;

BuySetup = XLRAverage > XLRAverage[1] AND Close > XLRAverage AND Moment < 0 AND Moment > Moment[1];
SellSetup = XLRAverage < XLRAverage[1] AND Close < XLRAverage AND Moment > 0 AND Moment < Moment[1];

If BuySetup Then Begin
BuyPrice = High + ( EntryPct * ATR );
LongCounter = 1;
End;

If SellSetup Then Begin
SellPrice = Low - ( EntryPct * ATR );
ShortCounter = 1;
End;

If LongCounter <= EntryCnt Then
Buy next bar at BuyPrice Stop;
If ShortCounter <= EntryCnt Then
Sell next bar at SellPrice Stop;

IncludeSystem:"ATR Big Profit Stop", BIGPROFS, LENGTH, EXITBARS;
IncludeSystem:"ATR Breakeven Stop", BKEVEN, LENGTH;
IncludeSystem:"ATR Protective Stop", PROTECT, LENGTH;
IncludeSystem:"ATR Trailing Stop", TRAILING, LENGTH;
IncludeSystem:"ATR Volatility Stop", VOLATILE, LENGTH;

{For Backtesting Purposes}
If LastBaronChart Then Begin
Sell this bar on Close;
BuyToCover this bar on Close;
End;

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: IncludeSystem - Replaced in PowerLanguage with?

Postby JoshM » 26 May 2015

I have recently been updating the code of some old easyLanguage systems so that I can run and test and modify them using MultiCharts. Usually the fixes are simple; however, I can't seem to figure out how to replace the old easyLanguage 'IncludeSystem' syntax in PowerLanguage. I have tried substituting 'IncludeStrategy' and 'IncludeSignal' to no avail. I am including the troublesome code below:

Code: Select all

IncludeSystem:"ATR Big Profit Stop", BIGPROFS, LENGTH, EXITBARS;
IncludeSystem:"ATR Breakeven Stop", BKEVEN, LENGTH;
IncludeSystem:"ATR Protective Stop", PROTECT, LENGTH;
IncludeSystem:"ATR Trailing Stop", TRAILING, LENGTH;
IncludeSystem:"ATR Volatility Stop", VOLATILE, LENGTH;
It looks like `IncludeSystem` adds another signal to the chart - correct?

If that's the case, we can replicate that behaviour with the `CommandLine()` keyword and its commands and parameters.

For example, adding the "ATR Big Profit Stop" signal to the chart is done as follows:

Code: Select all

CommandLine(".isig name1=ATR Big Profit Stop");
However, it's sadly not possible to change the inputs of the indicators or signals that are added with the `CommandLine()` programmatically, so it won't replicate the way `IncludeSystem` seems to work completely.


Return to “MultiCharts”