Using RC2 I have now been able to generate some multi-symbol strategies.
However, the generated rules are comparing the main chart data against the sub-chart data. Below is some MQ4 generated for such generated strategies.
The main chart in this example was EURUSD and the sub-chart 1 was USDJPY. It makes no logical sense to take the Close price of EURUSD and compare that to the moving-average price of USDJPY.
//------------------------
// Rule: Trading signals
//------------------------
if (sqIsBarOpen()) {
// init signals only on bar open
LongEntrySignal = (((Close[1] > sqBands(NULL,0, 50, 2.1, 0, PRICE_CLOSE, 1, 1))
&& (Close[1] < sqMA(NULL,0, 50, 0, 3, PRICE_CLOSE, 1)))
&& (Close[1] < sqMA(Subchart1Symbol, Subchart1Timeframe, 12, 0, 2, PRICE_HIGH, 1)));
ShortEntrySignal = (((Close[1] < sqBands(NULL,0, 50, 2.1, 0, PRICE_CLOSE, 0, 1))
&& (Close[1] > sqMA(NULL,0, 50, 0, 3, PRICE_CLOSE, 1)))
&& (Close[1] > sqMA(Subchart1Symbol, Subchart1Timeframe, 12, 0, 2, PRICE_HIGH, 1)));
When making any comparisons, it is safest in the simplest case to only compare main-chart values with main-chart values and sub-chart1 values with other sub-chart1 values and sub-chart2 values with other sub-chart2 values. In a more complex sense, building blocks that return values in a fixed range, such a percentages or RSI could be compared across symbols.
Clearly the closing price of one currency should not be compared against some price of a different currency pair. In the example above, the MQ4 should be:
//------------------------
// Rule: Trading signals
//------------------------
if (sqIsBarOpen()) {
// init signals only on bar open
LongEntrySignal = (((Close[1] > sqBands(NULL,0, 50, 2.1, 0, PRICE_CLOSE, 1, 1))
&& (Close[1] < sqMA(NULL,0, 50, 0, 3, PRICE_CLOSE, 1)))
&& (iClose(Subchart1Symbol, Subchart1Timeframe, 1) < sqMA(Subchart1Symbol, Subchart1Timeframe, 12, 0, 2, PRICE_HIGH, 1)));
ShortEntrySignal = (((Close[1] < sqBands(NULL,0, 50, 2.1, 0, PRICE_CLOSE, 0, 1))
&& (Close[1] > sqMA(NULL,0, 50, 0, 3, PRICE_CLOSE, 1)))
&& (iClose(Subchart1Symbol, Subchart1Timeframe, 1) > sqMA(Subchart1Symbol, Subchart1Timeframe, 12, 0, 2, PRICE_HIGH, 1)));
https://docs.mql4.com/series/iclose
And the pseudocode should be:
//--------------------------------------------------------------------
// Trading rule: Trading signals (On Bar Open)
//--------------------------------------------------------------------
LongEntrySignal = ((Close above BollingerBands(Main chart,50, 2.1).LowerBand
and (Bar closes below LinearWeighted Moving Average(Main chart,50)))
and (Bar(Subchart1) closes below Smoothed Moving Average(Subchart1, D1,12)));
ShortEntrySignal = ((Close below BollingerBands(Main chart,50, 2.1).UpperBand
and (Bar closes above LinearWeighted Moving Average(Main chart,50)))
and (Bar(Subchart1) closes above Smoothed Moving Average(Subchart1, D1,12)));
instead of just Bar
Please fix this.
Thanks & Regards,
Mike
Description changed:
Using RC2 I have now been able to generate some multi-symbol strategies.
However, the generated rules are comparing the main chart data against the sub-chart data. Below is some MQ4 generated for such generated strategies.
The main chart in this example was EURUSD and the sub-chart 1 was USDJPY. It makes no logical sense to take the Close price of EURUSD and compare that to the moving-average price of USDJPY.
//------------------------
// Rule: Trading signals
//------------------------
if (sqIsBarOpen()) {
// init signals only on bar open
LongEntrySignal = (((Close[1] > sqBands(NULL,0, 50, 2.1, 0, PRICE_CLOSE, 1, 1))
&& (Close[1] < sqMA(NULL,0, 50, 0, 3, PRICE_CLOSE, 1)))
&& (Close[1] < sqMA(Subchart1Symbol, Subchart1Timeframe, 12, 0, 2, PRICE_HIGH, 1)));
ShortEntrySignal = (((Close[1] < sqBands(NULL,0, 50, 2.1, 0, PRICE_CLOSE, 0, 1))
&& (Close[1] > sqMA(NULL,0, 50, 0, 3, PRICE_CLOSE, 1)))
&& (Close[1] > sqMA(Subchart1Symbol, Subchart1Timeframe, 12, 0, 2, PRICE_HIGH, 1)));
When making any comparisons, it is safest in the simplest case to only compare main-chart values with main-chart values and sub-chart1 values with other sub-chart1 values and sub-chart2 values with other sub-chart2 values. In a more complex sense, building blocks that return values in a fixed range, such a percentages or RSI could be compared across symbols.
Clearly the closing price of one currency should not be compared against some price of a different currency pair. In the example above, the MQ4 should be:
//------------------------
// Rule: Trading signals
//------------------------
if (sqIsBarOpen()) {
// init signals only on bar open
LongEntrySignal = (((Close[1] > sqBands(NULL,0, 50, 2.1, 0, PRICE_CLOSE, 1, 1))
&& (Close[1] < sqMA(NULL,0, 50, 0, 3, PRICE_CLOSE, 1)))
&& (iClose(Subchart1Symbol, Subchart1Timeframe, 1) < sqMA(Subchart1Symbol, Subchart1Timeframe, 12, 0, 2, PRICE_HIGH, 1)));
ShortEntrySignal = (((Close[1] < sqBands(NULL,0, 50, 2.1, 0, PRICE_CLOSE, 0, 1))
&& (Close[1] > sqMA(NULL,0, 50, 0, 3, PRICE_CLOSE, 1)))
&& (iClose(Subchart1Symbol, Subchart1Timeframe, 1) > sqMA(Subchart1Symbol, Subchart1Timeframe, 12, 0, 2, PRICE_HIGH, 1)));
https://docs.mql4.com/series/iclose
And the pseudocode should be:
//--------------------------------------------------------------------
// Trading rule: Trading signals (On Bar Open)
//--------------------------------------------------------------------
LongEntrySignal = ((Close above BollingerBands(Main chart,50, 2.1).LowerBand
and (Bar closes below LinearWeighted Moving Average(Main chart,50)))
and (Bar(Subchart1) closes below Smoothed Moving Average(Subchart1, D1,12)));
ShortEntrySignal = ((Close below BollingerBands(Main chart,50, 2.1).UpperBand
and (Bar closes above LinearWeighted Moving Average(Main chart,50)))
and (Bar(Subchart1) closes above Smoothed Moving Average(Subchart1, D1,12)));
instead of just Bar
Please fix this.
Thanks & Regards,
Mike