Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using Wizard to enter trade at previous candle open price

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Using Wizard to enter trade at previous candle open price

    Dear Sir Madam: I am not a good code writer and so I find the Strategy Wizard very useful. However, I am preplexed to figure out how to have my entry price match that of my previous Heiken Ashi candle open price.

    In other words, I have already figured out how to enter when my Heiken Ashi candle change colors from red to green, then go long. However, I don't want it to enter at the High price of the previous candle. I want to enter at the previous Open price of the candle. Can you help?
    Respectfully,
    CactusMo.

    #2
    Hello CactusMo,

    This can be accomplished with the strategy wizard using the following strategy outline :

    1. Awaiting crossover and flat : Check for a crossover. If one occurs, go to 2, otherwise, store the current price and remain here.
    2. Just crossed : enter a position at the stored price. Go to 3
    3. Open : Remain here until flat. Once flat, go to 1.

    In more detail, this is how to accomplish this in the condition builder :


    1. Condition set 1
      1. For the top section labeled "When the following conditions are true" which I will abbreviate TS from now on, this is your existing "Red to Green" condition
      2. For the bottom section labeled "Do the following" which I will abbreviate BS from now on -> Add
        1. Misc -> Set user defined variable
          1. Variable -> Variable0
          2. Value -> 1
        2. OK
    2. Condition set 2
      1. For the top section labeled "When the following conditions are true" which I will abbreviate TS from now on, this is your existing "Green to Red" condition
      2. For the bottom section labeled "Do the following" which I will abbreviate BS from now on -> Add
        1. Misc -> Set user defined variable
          1. Variable -> Variable0
          2. Value -> 2
        2. OK
    3. Condition set 3
      1. TS -> Add
        1. Left hand side (LHS) -> Strategy -> Flat
        2. Operation (Op) -> ==
        3. Right hand side (RHS) -> Misc -> True
        4. OK
      2. TS -> Add
        1. LHS -> User variables -> Variable 0
        2. Op -> !=
        3. RHS -> Numeric value -> 1
        4. OK
      3. TS -> Add
        1. LHS -> User variables -> Variable 0
        2. Op -> !=
        3. RHS -> Numeric value -> 2
        4. OK
      4. BS -> Add
        1. Misc -> Set user defined variable
          1. Variable -> Variable1
          2. Value -> ...
            1. Price data -> Close
            2. OK
          3. OK
    4. Condition set 4
      1. TS -> Add
        1. Left hand side (LHS) -> Strategy -> Flat
        2. Operation (Op) -> ==
        3. Right hand side (RHS) -> Misc -> True
        4. OK

      1. TS -> Add
        1. LHS -> User variables -> Variable 0
        2. Op -> ==
        3. RHS -> Numeric value -> 1
        4. OK
      2. BS -> Add
        1. Misc -> Set user defined variable
          1. Variable -> Variable0
          2. Value -> 0
        2. Order management -> Enter long position
        3. OK
    5. Condition set 5
      1. TS -> Add
        1. Left hand side (LHS) -> Strategy -> Flat
        2. Operation (Op) -> ==
        3. Right hand side (RHS) -> Misc -> True
        4. OK
      2. TS -> Add
        1. LHS -> User variables -> Variable 0
        2. Op -> ==
        3. RHS -> Numeric value -> 2
        4. OK
      3. BS -> Add
        1. Misc -> Set user defined variable
          1. Variable -> Variable0
          2. Value -> 0
        2. Order management -> Enter short position
        3. OK

    You may need to switch the "Enter long" and "Enter short" positions if I misinterpreted what red and green mean to your candles. Please let us know if any of the above is unclear or if there is any other way we can help.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Any easier way

      Hello JessicaP ~


      Thanks for going through all that trouble outlining the coding steps suggested. Is there something a little more simple?


      My wizard coding for entering the trade is very simple. I have:

      EnterLongLimit(DefaultQuantity, GetCurrentBid


      However, instead of get CurrentBid, I would have preferred to select "Open" from the Price Data menu. But I don't see where I can state to choose "Bar ago 1"


      Can you make it so I have a choice to select Bar ago 1, Open price?


      Can it be that easy?


      Respectfully
      ...CactusMo

      Comment


        #4
        Thank you for explaining the situation. To make sure I understand, you noticed a BarsAgo setting in the condition builder (picture 1), and were likely unable to find such a setting in order entry (picture 2) ?

        If that is the case, please place a Limit order instead of a Market order, to the appropriate price, as shown in pictures 3 and 4.
        Attached Files
        Jessica P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cre8able, Yesterday, 01:16 PM
        3 responses
        11 views
        0 likes
        Last Post cre8able  
        Started by ChartTourist, Today, 08:22 AM
        0 responses
        6 views
        0 likes
        Last Post ChartTourist  
        Started by LiamTwine, Today, 08:10 AM
        0 responses
        2 views
        0 likes
        Last Post LiamTwine  
        Started by Balage0922, Today, 07:38 AM
        0 responses
        5 views
        0 likes
        Last Post Balage0922  
        Started by JoMoon2024, Today, 06:56 AM
        0 responses
        6 views
        0 likes
        Last Post JoMoon2024  
        Working...
        X