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 rocketman7, Today, 02:12 AM
        7 responses
        31 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by guillembm, Yesterday, 11:25 AM
        3 responses
        16 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by junkone, 04-21-2024, 07:17 AM
        10 responses
        149 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by tsantospinto, 04-12-2024, 07:04 PM
        6 responses
        101 views
        0 likes
        Last Post tsantospinto  
        Started by trilliantrader, 04-18-2024, 08:16 AM
        7 responses
        28 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X