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

total number of bars onrender and period

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

    #31
    Draw.TextFixed(this, "sumvolfibo", sumvolfibo, TextPosition.TopRight);

    If i supply ther variable i get 2 error messages:
    NinjaScript File Error Code Line Column
    SampleDisplayBarsAgo.cs The overloaded method that best matches 'NinjaTrader.NinjaScript.DrawingTools.Draw.TextFix ed (NinjaTrader.NinjaScript.NinjaScriptBase, string, string, NinjaTrader.NinjaScript.DrawingTools.TextPosition) ' has invalid arguments CS1502 769 6

    NinjaScript File Error Code Line Column
    SampleDisplayBarsAgo.cs Argument 3: Can not convert from 'double' to 'string' CS1503 769 41

    You a re talking about 2 different things.
    Is it possible on render to get my variable in the chart with
    Draw.TextFixed(this, "sumvolfibo", sumvolfibo, TextPosition.TopRight);

    What is Text Rendering ? i dont see the difference with Draw.TextFixed(this, "sumvolfibo", sumvolfibo, TextPosition.TopRight); it will produce the same error message.


    For the vertical line i came up with this code:


    foundIndex = barIndex;
    int yByValue = chartScale.GetYByValue(foundIndex);
    float chartScaleYValue = chartScale.GetYByValue(yByValue);
    float chartScaleXValue = ChartBars.GetBarIdxByX(chartControl, cursorPointX);
    SharpDX.Vector2 startPoint = new SharpDX.Vector2(chartScaleXValue);
    SharpDX.Vector2 endPoint = new SharpDX.Vector2(chartScaleYValue);


    SharpDX.Direct2D1.SolidColorBrush customDXBrush = new SharpDX.Direct2D1.SolidColorBrush(RenderTarget, SharpDX.Color.DodgerBlue);


    RenderTarget.DrawLine(startPoint, endPoint, customDXBrush, 2);


    customDXBrush.Dispose();



    It compile and there's in log that message:
    2019-07-16 14:20:45 NinjaScript Multiple Bartypes with the same BarsPeriodType were found. Ignoring NinjaTrader.NinjaScript.BarsTypes.MirrorBarsType



    My coordinate are wrong i am all mixt up. Its getting close i get a line just not at the right place.







    ty
    Last edited by frankduc; 07-16-2019, 01:49 PM.

    Comment


      #32
      Hello frankduc,

      If you are having trouble writing syntax and are receiving compiler errors, I suggest using the Strategy Builder to generate syntax so you can better learn how to write it. For example, you could use Draw.TextFixed in the Strategy Builder and observe that syntax to see how it should be written. You could also specify a variable with Draw.TextFixed in the Builder and click View Code to specifically see how that code is written. Writing proper syntax will be required when working with unlocked code. I suggest doing this to better learn Drawing Tools so you are not facing the same challenges as with using SharpDX and OnRender which is reserved for advanced programmers.

      The compiler error for BarsTypes is mentioning that you have a BarsType on your platform that is using a BarsPeriodType index that is already in use. Please see how the UniRenko BarsType adds a unique index at line 39 and please see the documentation below if you want to fix this BarsType. Otherwise, I suggest right clicking on the BarsType and selecting "Exclude from compilation."

      UniRenko - https://ninjatraderecosystem.com/use...nko-bartype-8/

      BarsPeriod - https://ninjatrader.com/support/help...barsperiod.htm

      Our recommendation for working with SharpDX rendering would be to create small scripts where you can test working rendering code and you can compare it with any custom implementation you are working on.

      The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

      If you have any other NinjaTrader related inquiries, please do not hesitate to open a new ticket.
      JimNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by junkone, Today, 11:37 AM
      0 responses
      0 views
      0 likes
      Last Post junkone
      by junkone
       
      Started by quantismo, 04-17-2024, 05:13 PM
      5 responses
      33 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by proptrade13, Today, 11:06 AM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by love2code2trade, 04-17-2024, 01:45 PM
      4 responses
      34 views
      0 likes
      Last Post love2code2trade  
      Started by cls71, Today, 04:45 AM
      2 responses
      10 views
      0 likes
      Last Post eDanny
      by eDanny
       
      Working...
      X