Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Buffer prices after condition satisfied

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

    Buffer prices after condition satisfied

    Say in EURUSD 15 mins chart, if condition A happens I will

    A. wait price to drop another 5 pips before going short; similarly, wait for the price to raise another 5 pips before going long.

    B. if the price does not drops (for short) or raise (for long) 5 pips for 4 consecutive candle after the condition A satisfied, then abandon the current trade.

    Is there a way to represent A and B directly in the strategy tester wizard? or strategy tester code editor if wizard is not possible.
    Last edited by jack1234; 05-02-2017, 12:10 AM.

    #2
    Hello jack1234,

    Thanks for your post and welcome to the NinjaTrader forums!

    You've posted in the NinjaTrader8 strategy forum but have used the term strategy wizard which is what the strategy builder was called in NinjaTrader7, so in NinjaTrader7 no you would not be able to code the logic in the strategy wizard and would have to use the Ninjascript editor.

    In the NinjaTrader8 strategy builder, you could create the strategy.

    In the strategy, you have "Sets" each set has a conditions window and an "action" window.

    In one set you would evaluate your statement, " if condition A happens" in the conditions window. In the actions window you would save the price that you wish to compare into a double variable, set a bool variable to true, and save the current bar number to an integer variable. The bool variable will be used in subsequent sets to then evaluate your conditions A & B

    In subsequent sets, in the condition window you would check that:
    1) the bool is set to true (that tells that the first condition is true)
    2) the current bar is less than the saved bar + 4 (this is your duration check)
    3) the current price is less or greater than the saved price +/- your 5 pips
    In the action window then you would place your long or short order and then set the bool to false to prevent or reset conditions for the initial evaluation.

    You would need another set that checks that the current bar is > the saved bar + 4 to then have the action to reset the bool so you can restart the initial evaluation. This is needed in case the previous sets do not place an order and do not reset the bool.
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by pechtri, 06-22-2023, 02:31 AM
    10 responses
    124 views
    0 likes
    Last Post Leeroy_Jenkins  
    Started by judysamnt7, 03-13-2023, 09:11 AM
    4 responses
    59 views
    0 likes
    Last Post DynamicTest  
    Started by ScottWalsh, Yesterday, 06:52 PM
    4 responses
    36 views
    0 likes
    Last Post ScottWalsh  
    Started by olisav57, Yesterday, 07:39 PM
    0 responses
    7 views
    0 likes
    Last Post olisav57  
    Started by trilliantrader, Yesterday, 03:01 PM
    2 responses
    22 views
    0 likes
    Last Post helpwanted  
    Working...
    X