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

Two questions about strategy builder.

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

    Two questions about strategy builder.

    Hi,
    Stuck again

    Very simple method. Need help selecting from strategy builder because these two selections don't work.

    1. Buy at specified date only. In this case July 3, 2017. (only testing month by month)
    I know I must choose Time-Date Value, but don't know what else to select.

    2. Price has risen by 15% or greater in the last 22 bars before the specified date of buying. (basically the previous month)

    Thanks,Simon

    #2
    Hi,

    1) Why not define the specific date in strategy analyzer ?

    2) Something like this could work:

    else if (State == State.DataLoaded)
    {
    ROC1 = ROC(Close, 1);
    MAX1 = MAX(ROC1, 22);
    }
    }

    protected override void OnBarUpdate()
    {
    if (CurrentBars[0] < 1)
    return;

    // Set 1
    if (MAX1[0] == 0.15)
    {
    }

    Comment


      #3
      Hello GeminiSi,

      Thank you for writing to the support team.

      I am reviewing your inquiry and will be back with a reply shortly.

      I look forward to assisting further.
      Chris L.NinjaTrader Customer Service

      Comment


        #4
        Hello GeminiSi,

        Thank you for the post.

        Due to the complexity of this logic, you will need to unlock your code and program the following by hand.

        1. You can enclose your entry inside of an IF statement that checks if the current date == July 3, 2017/2018 like so:

        Code:
        
        private int targetYear = ??
        private int targetMonth = ??
        private int target day = ??
        
        OnBarUpdate() {
        
        if(DateTime.Now.Year == targetYear && DateTime.Now.Month == targetMonth && DateTime.Now.Day == targetDay){
        
                EnterLong();
        
        ...
        
        }
        2. Countif to check if the price has risen up to or greater than %15 of the current price in the last 22 bars.

        Exemplar:

        Code:
        OnBarUpdate(){
        
        if(CountIf(() => Close[0] >= (GetCurrentBid() + (GetCurrentBid()*0.15)), 22) >= 1){
        
                //In the last 22 bars, at least one of those bars was 15% greater than the current 
                  price. 
        
        }
        
        ...
        More on Countif() here:


        More on GetCurrentBid() here:


        Please let us know if we may be of any further assistance.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by DayTradingDEMON, Today, 09:28 AM
        4 responses
        21 views
        0 likes
        Last Post DayTradingDEMON  
        Started by geddyisodin, Yesterday, 05:20 AM
        9 responses
        50 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by George21, Today, 10:07 AM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Started by Stanfillirenfro, Today, 07:23 AM
        9 responses
        24 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by navyguy06, Today, 09:28 AM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X