- ago
Hi,

I built a strategy where I used Sell at Market exit block and I wanted to put two conditions in there being:

- Indicator compare to Indicator = EMA less than EMA
- indicator compare to Indicator = Close less than EMA

On the second condition, I used a qualifier Indicator Symbol which display on screen as the scope of application for that symbol only.

However, I found out (by converting it to the code and looking at it) that such arrangement results in qualifier that was applied to a second condition ends up being applied to both (as they are in the same block) despite visualisation implying that it only applies to the second indicator.

The workaround is to put the second indicator in a separate Sell at Market block and then it works as intended.

Considering that visualisation implies different intent than produced, I am raising it as a bug unless this was an intended behaviour (which would appear confusing).
0
201
Solved
7 Replies

Reply

Bookmark

Sort
Glitch8
 ( 10.33% )
- ago
#1
This isn't correct as far as I can see. Here is the generated code for what you describe, the external symbol is being applied to the indicators used in the second condition only.

CODE:
public override void Initialize(BarHistory bars) {          source = bars.Low;          pct = 1.00;          pct = (100.0 - pct) / 100.0;          multSource = source * pct;          PlotStopsAndLimits(3);          indicator1 = new EMA(bars.Close,20);          PlotIndicator(indicator1,new WLColor(0,0,0));          _startIndexList.Add(indicator1);          indicator2 = new EMA(bars.Close,50);          PlotIndicator(indicator2,new WLColor(0,0,255));          _startIndexList.Add(indicator2);          externalSymbol = GetHistory(bars, "QQQ");          indicator12 = externalSymbol.Close;          indicator22 = new EMA(externalSymbol.Close,20);          _startIndexList.Add(indicator22); foreach(IndicatorBase ib in _startIndexList) if (ib.FirstValidIndex > StartIndex) StartIndex = ib.FirstValidIndex; }
0
- ago
#2
So here is an image of the code and the conditions I am talking about...The visual does not correspond directly to the code (as I have extracted code individually)



So in the code with a single line....the setup was with two Sell at Market but the top one did not have two conditions but one.

So the qualifier implies that it only relates to the Close is less than EMA block but in fact applies to the whole Sell at Market block and every item in it (i.e. first Close block)
0
Glitch8
 ( 10.33% )
- ago
#3
It doesn’t apply to the whole sell block. It applies only to the condition it’s attached to.
0
- ago
#4
Based on our example, we found it that the qualifier did apply to the both conditions in the same block, (the left code is the one whereby both conditions were in the same sell block and bottom sell block was deleted) while the right code is where two conditions were in the individual sell blocks (not repeated like in the image).

We further confirmed it by running the backtest in both configurations and getting the different results.

Does this help?
0
- ago
#5
QUOTE:
However, I found out (by converting it to the code and looking at it) that such arrangement results in qualifier that was applied to a second condition ends up being applied to both (as they are in the same block)

I too have rebuilt your conditions and the claim seems to be wrong. The EMA(5) is NOT affected by the external symbol condition:
CODE:
         indicator1 = new EMA(bars.Close,5);          PlotIndicator(indicator1,new WLColor(0,0,0));          _startIndexList.Add(indicator1);
0
- ago
#6
My apologies...for some reason I thought I saw the difference in WL editor but when I brought it to IDE and looked closer, you are correct...it is not a system bug...it is a logic execution issue (AND/OR) and hence different outcomes (image attached). I assume that this is a desired behaviour so it is user awareness issue (I like it that we have control of both). Please let me know if my interpretation is incorrect

0
Cone8
 ( 7.88% )
- ago
#7
Correct.
Conditions are AND'd unless you put an OR between them (or otherwise use a MultiCondition block).
0
Best Answer

Reply

Bookmark

Sort