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

How to do this correctly?

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

    How to do this correctly?

    Hello,

    I have a List variable which includes all the executions (read from the external application) and I am trying to add Up and Down arrows to the execution points on the chart but I cannot get it to work correctly. Arrows are not shown everytime and they disappear and comes back when I scroll the chart.

    I have checked by printing this "Kaupat" List object to the output window so it really includes all the execution data and everything is in order.

    Here are the key points of the script:

    // This is the structure for the execution information
    public struct Kauppa
    {
    public string symbol;
    public string dir;
    public int position;
    public double price;
    public DateTime dateTime;
    public Kauppa(string sy, string di, int po, double pr, DateTime dt)
    {
    symbol = sy;
    dir = di;
    position = po;
    price = pr;
    dateTime = dt;
    }
    }

    // This list holds the executions. This list is initialized from the disk
    // file elsewhere in the script
    private List<Kauppa> Kaupat;

    // Here I try to update the chart. Is this the correct place for this purpose?
    protected override void OnBarUpdate()
    {
    foreach(Kauppa k in Kaupat)
    {
    if(k.dateTime <= Time[0] && k.dateTime > Time[1])
    if(k.dir.CompareTo("BOT") == 0)
    DrawArrowUp("", true, 0, Low[0]-TickSize*2, Color.Green);
    else
    DrawArrowDown("", true, 0, High[0]+TickSize*2, Color.Red);
    }
    }

    SG

    #2
    ScalpGuy, unfortunately this outside of our supported scope - but for your DrawArrows I would suggest using a unique drawing tag ID if you want multiple arrows displayed instead of only modifying one.

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Sorry I did not know that this kind of questions cannot be asked.

      BUT thank you very much for the support anyway. Now it works!

      Comment


        #4
        Great that did the trick ScalpGuy!
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by judysamnt7, 03-13-2023, 09:11 AM
        4 responses
        59 views
        0 likes
        Last Post DynamicTest  
        Started by ScottWalsh, Today, 06:52 PM
        4 responses
        36 views
        0 likes
        Last Post ScottWalsh  
        Started by olisav57, Today, 07:39 PM
        0 responses
        7 views
        0 likes
        Last Post olisav57  
        Started by trilliantrader, Today, 03:01 PM
        2 responses
        21 views
        0 likes
        Last Post helpwanted  
        Started by cre8able, Today, 07:24 PM
        0 responses
        10 views
        0 likes
        Last Post cre8able  
        Working...
        X