• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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:
        https://ninjatrader.com/support/help...s/?countif.htm

        More on GetCurrentBid() here:
        https://ninjatrader.com/support/help...currentbid.htm

        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 tecmisc1, Today, 09:57 AM
        0 responses
        2 views
        0 likes
        Last Post tecmisc1  
        Started by mbesha, Today, 09:26 AM
        0 responses
        1 view
        0 likes
        Last Post mbesha
        by mbesha
         
        Started by Brillo, Today, 08:58 AM
        0 responses
        6 views
        0 likes
        Last Post Brillo
        by Brillo
         
        Started by avrege, Today, 01:48 AM
        2 responses
        13 views
        0 likes
        Last Post avrege
        by avrege
         
        Started by markbb10, Today, 07:14 AM
        0 responses
        7 views
        0 likes
        Last Post markbb10  
        Working...
        X