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

Different Values for each Chart

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

    Different Values for each Chart

    Hello,

    i create a strategy, which i use for different Charts (NQ / ES / CL).

    I use int Profittarget / SL. Can i change the Values for a spezific Charts, like

    if Chart = "ES" then PF = 10
    if else Chart = "CL" then PF = xy?



    #2
    Hello Dirales,

    Yes you can do that, is this a manually coded strategy or are you using the builder?
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello Jesse,

      i use a manually code:
      Code:
                      #region Resets ALL values when ALL positions are closed
                          if (Position.MarketPosition == MarketPosition.Flat && longEntry == null && shortEntry == null && longEntry2 == null && shortEntry2 == null && longEntry3 == null && shortEntry3 == null
                                  && targetLong == null && targetShort == null && targetLong2 == null && targetShort2 == null && targetLong3 == null && targetShort3 == null && Position.Quantity == 0)
                              {    
      //                            CurrentTriggerPrice    = 0;    CurrentStopPrice     = 0;    
                                  TrailStopBegin        = 16;    TrailFrequenz        = 1;    TrailStopDistanceMAX    = 22;    TrailStopDistance            = 16;
                                  EntryDistance        = 0;
                                  ProfitDistance1        = 22;     ProfitDistance2        = 26;    ProfitDistance3            = 32;
                                  StopDistance1        = 24;    StopDistance2        = 25;     StopDistance3            = 26;
                                  MaxOpenContract        = 5;
                                  closeopenorderafterxbar = 2;
                              }
                      #endregion​

      Comment


        #4
        Hello Dirales,

        You can do that kind of a within OnBarUpdate. Instead of using a UserInput you would use a standard variable:

        Code:
        private int pf = 10;
        protected override void OnBarUpdate()
        {
            if(Instrument.MasterInstrument.Name == "ES") pf = 12;


        JesseNinjaTrader Customer Service

        Comment


          #5
          Hello Jesse,

          thats ( Instrument.MasterInstrument.Name ) exact what i search. Many Thanks

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by AaronKoRn, Today, 09:49 PM
          0 responses
          7 views
          0 likes
          Last Post AaronKoRn  
          Started by carnitron, Today, 08:42 PM
          0 responses
          9 views
          0 likes
          Last Post carnitron  
          Started by strategist007, Today, 07:51 PM
          0 responses
          10 views
          0 likes
          Last Post strategist007  
          Started by StockTrader88, 03-06-2021, 08:58 AM
          44 responses
          3,980 views
          3 likes
          Last Post jhudas88  
          Started by rbeckmann05, Today, 06:48 PM
          0 responses
          9 views
          0 likes
          Last Post rbeckmann05  
          Working...
          X