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

Duplicate Dataseries and Modifie it

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

    Duplicate Dataseries and Modifie it

    Hello
    I have a strategy that works on the primary dataseries that mark the" trigger bar" with a colored arrow after the close of the bar (if the close start the trigger) .
    The close price of the trigger bar is the price of the limit order that have tu be used in order submission.

    I order to avoid slippage and not filling of the order, I would like to know if it is possible :

    1) duplicate the primary dataseries (I think yes)

    2) substitute (in the duplicate dataseries) dinamically the close[0] with a forecast price (this is the main question)

    3) allow strategy to calculate if that forecast price will start the trigger and , if the answer is "YES", submit the limit order with the forecast Price as limit price ( I think it is possibile)

    4) after the bar is closed the previous bar[0] that now is bar[1] have to be (in duplicate dataseries) set like bar [1] of the primary data series and the the new bar[0] modified (with the another forecast price) start the same process explained at point 3

    Forecast price is calculated by another function of the same strategy

    thanks for support
    Roberto




    #2
    Hello truesailor,

    Thanks for your post.

    Yes, you can add a duplicate data series but it would not be needed however you would not be able to change the price of a bar. I think all you really need to do here is to compare the current price to a forecast price and determine if that forecast price will trigger. You may need to run your strategy using Calculate.OnPriceChange so that you are looking at the real-time price (if you are not already).

    You may want or need to separate your logic so that some of it runs on each price change (the forecasting logic) while some of it only runs once per bar. Here is a link to our educational example of this: https://ninjatrader.com/support/help...either_cal.htm
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      The Strategy is based on double stochastics that works with a series of close...I could prepare a private series of the close and switch element0 with forecasted price and check the trigger; at the closing of the bar[0]=> that became bar[1], I could substitute element1 of the private series (previous element0) with Close[1] and insert new element0 (new forecast).

      how does it sounds?
      Roberto

      Comment


        #4
        Hello Roberto,

        Thanks for your reply.

        Yes, you can create a private data series (as it would have the same elements as the charts data series) and can assign the close value to it and/or any other value you wish.
        Reference: https://ninjatrader.com/support/help...s/?seriest.htm
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by andrewtrades, Today, 04:57 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by chbruno, Today, 04:10 PM
        0 responses
        4 views
        0 likes
        Last Post chbruno
        by chbruno
         
        Started by josh18955, 03-25-2023, 11:16 AM
        6 responses
        436 views
        0 likes
        Last Post Delerium  
        Started by FAQtrader, Today, 03:35 PM
        0 responses
        7 views
        0 likes
        Last Post FAQtrader  
        Started by rocketman7, Today, 09:41 AM
        5 responses
        19 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X