Hi everyone,
I am creating a very simple indicator for averaging down purposes. Its launched every day with different levels (grids) above from a levelZERO. The strategy (based in Nicholas’ averaging down example) always goes short. If the operation is positive, the next day start again a new levelZERO and the new grids above.
My question is that if the strategy start accumulating contracts or is above to (it is still open at the end of the day), the next day I would like to keep the original levelZERO levels, since the operation is still open.
With the strategy this is solve with the ON MARKET condition, but indicators do not allow OPEN/BUY commands. Anyone knows any trick to keep an indicator passive while ON MARKET, and start again when IS NOT ON MARKET???
I am posting the indicator. It is very simple.
Thanks in advance,
// AVERG DOWN indicator
defparam drawonlastbaronly= true
// parameters
rojo=open>close
// Determinición niveles GRID
IF time=020000 AND rojo THEN
levelZERO = close
ENDIF
IF time=030000 AND rojo AND NOT rojo[1] THEN
levelZERO = close
ENDIF
IF time=040000 AND rojo AND NOT rojo[1] AND NOT rojo[2] THEN
levelZERO = close
ENDIF
IF time=050000 AND rojo AND NOT rojo[1] AND NOT rojo[2] AND NOT rojo[3] THEN
levelZERO = close
ENDIF
IF time=060000 AND rojo AND NOT rojo[1] AND NOT rojo[2] AND NOT rojo[3] AND NOT rojo[4] THEN
levelZERO = close
ENDIF
IF time=070000 AND rojo AND NOT rojo[1] AND NOT rojo[2] AND NOT rojo[3] AND NOT rojo[4] AND NOT rojo[5] THEN
levelZERO = close
ENDIF
IF time=080000 AND rojo AND NOT rojo[1] AND NOT rojo[2] AND NOT rojo[3] AND NOT rojo[4] AND NOT rojo[5] AND NOT rojo[6] THEN
levelZERO = close
ENDIF
IF time=090000 AND rojo AND NOT rojo[1] AND NOT rojo[2] AND NOT rojo[3] AND NOT rojo[4] AND NOT rojo[5] AND NOT rojo[6] AND NOT rojo[7] THEN
levelZERO = close
ENDIF
IF time=100000 AND rojo AND NOT rojo[1] AND NOT rojo[2] AND NOT rojo[3] AND NOT rojo[4] AND NOT rojo[5] AND NOT rojo[6] AND NOT rojo[7] AND NOT rojo[8] THEN
levelZERO = close
ENDIF
// levels UP
grid=40
level5up = level4up + (grid)*pipsize
level4up = level3up + (grid)*pipsize
level3up = level2up + (grid)*pipsize
level2up = level1up + (grid/2)*pipsize
level1up = levelZERO + grid*pipsize
levelprofit = levelZERO - (grid/2)*pipsize
RETURN LevelZERO as "levelZERO", level1up as "level1up", level2up as "level2up", level3up as "level3up", level4up as "level4up", level5up as "level5up", levelprofit as "levelprofit"
Without having a chance to test it now, I would say another indicator that receives 0 or 1 from a strategy and retains it for other indicators to retrieve.
It doesn’t have to display anything on chart, just be CALLed from your indicator to return the 0 or 1 received from the strategy so that it may work or pause.
But I am not sure this is possible.
Sorry, it won’t work, ProOrder cannot communicate with ProBuilder.
CALLed indicators are a copy of what is on the chart. You can remove it from your chart and the strategy continues working.
No way.
Hi Roberto,
Thanks. I will create the selling (short) conditions in the indicator and will apply 0 or 1 to a successful trade, so next day will continue or not according to that 0 or 1.
The strategy will work anyway, but I created the indicator to visualise the entry levels. In this case, I will have to imagine those entry levels according to the (n) day in which the first sell short occurred.
Thanks so much,
Juan
If this is just about creating an indicator that knows whether you are on the market or not then you just have to simulate the strategies orders in the indicator and create a flag that tells the indicator whether you are on the market at the days close or not on the market at the days close. As Roberto says just switch a flag from 0 to 1 if a market entry condition is met and switch it to zero if a market exit condition is met.