ON MARKET condition in an indicator

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #92135 quote
    Juan Salas
    Participant
    Master

    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"
    
    
    
    
    
     
    
    levelZERO-AVERG-diario.itf Screen-Shot-2019-02-23-at-17.46.36.png Screen-Shot-2019-02-23-at-17.46.36.png
    #92145 quote
    robertogozzi
    Moderator
    Master

    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.

    #92146 quote
    robertogozzi
    Moderator
    Master

    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.

    #92148 quote
    Juan Salas
    Participant
    Master

    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

    #92149 quote
    Vonasi
    Moderator
    Master

    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.

    Juan Salas thanked this post
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

ON MARKET condition in an indicator


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Juan Salas @juan-salas Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by Vonasi
7 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/23/2019
Status: Active
Attachments: 2 files
Logo Logo
Loading...