>=28% of strats with one or more applied price calculations are not symmetrical.(anyMA,BB,MACd,highest,lowest,CCIetc.) They sometimes (2/7) use "PRICE_LOW" or "PRICE_HIGH" and do not negate....

Resolution of this issue (and other symmetry issues) will speed up builder production of useful symmetrical strategies drastically plus will eliminate a LOT of the work trying to figure out which ones are actually symmetrical (some of them only a programmer could figure out.)

The ultimate solution which would solve this bug is to simply have PRICE_HIGH negate to PRICE_LOW and vice versa all the time. 

If we can't have that simple solution then...I  get that it's hard to make complex blocks symmetrical but can we at least have it so that when symmetry is turned on we do not use PRICE_HIGH or PRICE_LOW in cases where we cannot negate? Like for moving averages and BB width? Also, can we please have a more standard Highest-High / Lowest-Low calculation that IS actually negatable for stop and limit order price levels? 


I think how it is now, the builder can never produce a symmetrical limit order strategy where the entry order price is based on series of highs and lows including highest high / lowest low... Is that correct? 

These ones are hard to spot because applied prices do not appear in pseudo code. I wouldn't mind seeing the applied price in the pseudo code for everything!
...
// Action #1
_ticket = sqOpenOrder(OP_BUYLIMIT, "Current", sqMMRiskFixedBalancePct("Current",OP_BUYSTOP,(iHigh(NULL,0, 1) -
(1.30 * sqBBWidthRatio(NULL,0, 19, 0.2, PRICE_LOW, 1))),sqGetSLLevel("Current", OP_BUYSTOP, (iHigh(NULL,0, 1) -
(1.30 * sqBBWidthRatio(NULL,0, 19, 0.2, PRICE_LOW, 1))), 2, 0.8 * sqATR(NULL,0,21,1)),mmRiskPercent,mmDecimals,mmLotsIfNoMM,mmMaxLots), (iHigh(NULL,0, 1) -
(1.30 * sqBBWidthRatio(NULL,0, 19, 0.2, PRICE_LOW, 1))), MagicNumber, "", 0, true, false, CLR_NONE);
...
// Action #1
_ticket = sqOpenOrder(OP_SELLLIMIT, "Current", sqMMRiskFixedBalancePct("Current",OP_SELLSTOP,(iLow(NULL,0, 1) +
(1.3 * sqBBWidthRatio(NULL,0, 19, 0.2, PRICE_LOW, 1))),sqGetSLLevel("Current", OP_SELLSTOP, (iLow(NULL,0, 1) +
(1.3 * sqBBWidthRatio(NULL,0, 19, 0.2, PRICE_LOW, 1))), 2, 0.8 * sqATR(NULL,0,21,1)),mmRiskPercent,mmDecimals,mmLotsIfNoMM,mmMaxLots), (iLow(NULL,0, 1) +
(1.3 * sqBBWidthRatio(NULL,0, 19, 0.2, PRICE_LOW, 1))), 0, "", 0, true, false, CLR_NONE);





Attachments
  • Votes +4
  • Project StrategyQuant X
  • Type Bug
  • Status Fixed
  • Priority Normal

History

b
#1

bentra

16.08.2019 23:01

Task created

b
#2

bentra

16.08.2019 23:56

Description changed:

MQ4 BB Width Ratio calculation is using "PRICE_LOW" as the applied price for both longs and shorts price levels is not symmetrical. I get that it's hard to make complex blocks symmetrical but can we at least have it so that when symmetry is turned on we do not use PRICE_HIGH or PRICE_LOW in cases where we cannot negate? I take it this is not something I can control with the template?
...
// Action #1
_ticket = sqOpenOrder(OP_BUYLIMIT, "Current", sqMMRiskFixedBalancePct("Current",OP_BUYSTOP,(iHigh(NULL,0, 1) -
(1.30 * sqBBWidthRatio(NULL,0, 19, 0.2, PRICE_LOW, 1))),sqGetSLLevel("Current", OP_BUYSTOP, (iHigh(NULL,0, 1) -
(1.30 * sqBBWidthRatio(NULL,0, 19, 0.2, PRICE_LOW, 1))), 2, 0.8 * sqATR(NULL,0,21,1)),mmRiskPercent,mmDecimals,mmLotsIfNoMM,mmMaxLots), (iHigh(NULL,0, 1) -
(1.30 * sqBBWidthRatio(NULL,0, 19, 0.2, PRICE_LOW, 1))), MagicNumber, "", 0, true, false, CLR_NONE);
...
// Action #1
_ticket = sqOpenOrder(OP_SELLLIMIT, "Current", sqMMRiskFixedBalancePct("Current",OP_SELLSTOP,(iLow(NULL,0, 1) +
(1.3 * sqBBWidthRatio(NULL,0, 19, 0.2, PRICE_LOW, 1))),sqGetSLLevel("Current", OP_SELLSTOP, (iLow(NULL,0, 1) +
(1.3 * sqBBWidthRatio(NULL,0, 19, 0.2, PRICE_LOW, 1))), 2, 0.8 * sqATR(NULL,0,21,1)),mmRiskPercent,mmDecimals,mmLotsIfNoMM,mmMaxLots), (iLow(NULL,0, 1) +
(1.3 * sqBBWidthRatio(NULL,0, 19, 0.2, PRICE_LOW, 1))), 0, "", 0, true, false, CLR_NONE);





b
#3

bentra

17.08.2019 00:07

Attachment bugged_applied.sqx added

bugged_applied.sqx
(55.23 KiB)
Oops forgot to attache strategy here is a similar one:

// Action #1
_ticket = sqOpenOrder(OP_BUYSTOP, "Current", sqMMRiskFixedBalancePct("Current",OP_BUYSTOP,(sqHighest("NULL",0, PRICE_HIGH, 33, 1) + (1 * sqATR(NULL,0, 41, 1))),0,mmRiskPercent,mmDecimals,mmLotsIfNoMM,mmMaxLots), (sqHighest("NULL",0, PRICE_HIGH, 33, 1) + (1 * sqATR(NULL,0, 41, 1))), MagicNumber, "", 0, true, false, CLR_NONE);
// Action #1
_ticket = sqOpenOrder(OP_SELLSTOP, "Current", sqMMRiskFixedBalancePct("Current",OP_SELLSTOP,(sqLowest("NULL",0, PRICE_HIGH, 33, 1) - (1 * sqATR(NULL,0, 41, 1))),0,mmRiskPercent,mmDecimals,mmLotsIfNoMM,mmMaxLots), (sqLowest("NULL",0, PRICE_HIGH, 33, 1) - (1 * sqATR(NULL,0, 41, 1))), 0, "", 0, true, false, CLR_NONE);


Also for this type of stop and limit order price level calculation.... I get that it's hard to make complex blocks symmetrical but can we at least have it so that when symmetry is turned on we do not use PRICE_HIGH or PRICE_LOW in cases where we cannot negate? Like for moving averages? Also, can we please have a more standard Highest-High / Lowest-Low calculation that IS actually negatable for stop and limit order price levels? 


I think how it is now, the builder can never produce a symmetrical limit order strategy where the order price is based on highs and lows... Is that correct? 

I wouldn't mind seeing the applied price in the pseudo code for everything!
b
#4

bentra

17.08.2019 00:26

Subject changed from BB width ratio using "PRICE_LOW" as applied price for both longs and shorts not symmetrical. Maybe just make that type of thing based on "Close" or "Typical" is best. to Many limit order order price level calculations are not symmetrical. They use "PRICE_LOW" or "PRICE_HIGH" and do not negate....

Description changed:

For this type of stop and limit order price level calculation.... I get that it's hard to make complex blocks symmetrical but can we at least have it so that when symmetry is turned on we do not use PRICE_HIGH or PRICE_LOW in cases where we cannot negate? Like for moving averages and BB width? Also, can we please have a more standard Highest-High / Lowest-Low calculation that IS actually negatable for stop and limit order price levels? 


I think how it is now, the builder can never produce a symmetrical limit order strategy where the entry order price is based on highs and lows... Is that correct? 

I wouldn't mind seeing the applied price in the pseudo code for everything!
...
// Action #1
_ticket = sqOpenOrder(OP_BUYLIMIT, "Current", sqMMRiskFixedBalancePct("Current",OP_BUYSTOP,(iHigh(NULL,0, 1) -
(1.30 * sqBBWidthRatio(NULL,0, 19, 0.2, PRICE_LOW, 1))),sqGetSLLevel("Current", OP_BUYSTOP, (iHigh(NULL,0, 1) -
(1.30 * sqBBWidthRatio(NULL,0, 19, 0.2, PRICE_LOW, 1))), 2, 0.8 * sqATR(NULL,0,21,1)),mmRiskPercent,mmDecimals,mmLotsIfNoMM,mmMaxLots), (iHigh(NULL,0, 1) -
(1.30 * sqBBWidthRatio(NULL,0, 19, 0.2, PRICE_LOW, 1))), MagicNumber, "", 0, true, false, CLR_NONE);
...
// Action #1
_ticket = sqOpenOrder(OP_SELLLIMIT, "Current", sqMMRiskFixedBalancePct("Current",OP_SELLSTOP,(iLow(NULL,0, 1) +
(1.3 * sqBBWidthRatio(NULL,0, 19, 0.2, PRICE_LOW, 1))),sqGetSLLevel("Current", OP_SELLSTOP, (iLow(NULL,0, 1) +
(1.3 * sqBBWidthRatio(NULL,0, 19, 0.2, PRICE_LOW, 1))), 2, 0.8 * sqATR(NULL,0,21,1)),mmRiskPercent,mmDecimals,mmLotsIfNoMM,mmMaxLots), (iLow(NULL,0, 1) +
(1.3 * sqBBWidthRatio(NULL,0, 19, 0.2, PRICE_LOW, 1))), 0, "", 0, true, false, CLR_NONE);





b
#5

bentra

17.08.2019 00:32

Attachment Strategy 0105 - temabug.sqx added

Strategy 0105 - temabug.sqx
(51.56 KiB)

Here's another where entry price is based on TEMA:

// Action #1
_ticket = sqOpenOrder(OP_BUYSTOP, "Current", sqMMRiskFixedBalancePct("Current",OP_BUYSTOP,sqTEMA(NULL,0, 23, PRICE_LOW, 1),0,mmRiskPercent,mmDecimals,mmLotsIfNoMM,mmMaxLots), sqTEMA(NULL,0, 23, PRICE_LOW, 1), MagicNumber, "", 0, true, false, CLR_NONE);
// Action #1
_ticket = sqOpenOrder(OP_SELLSTOP, "Current", sqMMRiskFixedBalancePct("Current",OP_SELLSTOP,sqTEMA(NULL,0, 23, PRICE_LOW, 1),0,mmRiskPercent,mmDecimals,mmLotsIfNoMM,mmMaxLots), sqTEMA(NULL,0, 23, PRICE_LOW, 1), 0, "", 0, true, false, CLR_NONE);

Looks like about 20% of strategies produced by builder are effected plus these ones are hard to notice till you get deep in to testing because they don't give a hint in the pseudo code.





b
#6

bentra

17.08.2019 00:47
Voted for this task.
b
#7

bentra

17.08.2019 00:53

Attachment fsc.sqx added

fsc.sqx
(2.70 KiB)
I guess I should give my template in case this is only effecting me and my template.


b
#8

bentra

17.08.2019 01:04

Attachment Strategy 017 - builder - applied - bugged.sqx added

Strategy 017 - builder - applied - bugged.sqx
(38.47 KiB)
Uh OH here's one from regular builder not from template =(

But I'm finding it really hard to believe that this could've gone unnoticed for so long.....

// Action #1
_ticket = sqOpenOrder(OP_BUYSTOP, "Current", sqMMRiskFixedBalancePct("Current",OP_BUYSTOP,sqLowest("NULL",0, PRICE_HIGH, 48, 1),0,mmRiskPercent,mmDecimals,mmLotsIfNoMM,mmMaxLots), sqLowest("NULL",0, PRICE_HIGH, 48, 1), MagicNumber, "", 0, true, false, CLR_NONE);
// Action #1
_ticket = sqOpenOrder(OP_SELLSTOP, "Current", sqMMRiskFixedBalancePct("Current",OP_SELLSTOP,sqHighest("NULL",0, PRICE_HIGH, 48, 1),0,mmRiskPercent,mmDecimals,mmLotsIfNoMM,mmMaxLots), sqHighest("NULL",0, PRICE_HIGH, 48, 1), MagicNumber, "", 0, true, false, CLR_NONE);

b
#9

bentra

18.08.2019 04:24

Attachment Strategy 016844-signalpricebugged.sqx added

Strategy 016844-signalpricebugged.sqx
(53.21 KiB)
Also same thing effecting many signal logic:

// init signals only on bar open
LongEntrySignal = (((iClose(NULL,0, 1) > iHigh(NULL,0, 2))
&& (true))
&& (((sqStdDev(NULL,0, 34, 0, MODE_SMA, PRICE_CLOSE, 1+2) > sqStdDev(NULL,0, 34, 0, MODE_SMA, PRICE_CLOSE, 1+1))&& (sqStdDev(NULL,0, 34, 0, MODE_SMA, PRICE_CLOSE, 1+1) < sqStdDev(NULL,0, 34, 0, MODE_SMA, PRICE_CLOSE, 1)))
&& (sqMACD(NULL,0, 32, 42, 21, PRICE_LOW, MODE_MAIN, 1)<sqMACD(NULL,0, 32, 42, 21, PRICE_LOW, MODE_SIGNAL, 1))));

ShortEntrySignal = (((iClose(NULL,0, 1) < iLow(NULL,0, 2))
&& (true))
&& (((sqStdDev(NULL,0, 34, 0, MODE_SMA, PRICE_CLOSE, 1+2) > sqStdDev(NULL,0, 34, 0, MODE_SMA, PRICE_CLOSE, 1+1))&& (sqStdDev(NULL,0, 34, 0, MODE_SMA, PRICE_CLOSE, 1+1) < sqStdDev(NULL,0, 34, 0, MODE_SMA, PRICE_CLOSE, 1)))
&& (sqMACD(NULL,0, 32, 42, 21, PRICE_LOW, MODE_MAIN, 1)>sqMACD(NULL,0, 32, 42, 21, PRICE_LOW, MODE_SIGNAL, 1))));

m
#10

mabi

19.08.2019 22:22
Voted for this task.
FB
#11

lumbrjack

22.08.2019 15:52
Voted for this task.
MF
#12

Mark Fric

23.08.2019 11:18

Status changed from New to Fixed

fixed, in all blocks PRICE_HIGH is negated to PRICE_LOW and vice versa.


I also added display of applied price in pseudo code.

da
#13

Artur

23.08.2019 23:10
Voted for this task.

Votes: +4

Drop files to upload

or

choose files

Max size: 5MB

Not allowed: exe, msi, application, reg, php, js, htaccess, htpasswd, gitignore

...
Wait please