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

DrawDot() doesn't work

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

    DrawDot() doesn't work

    Hello.
    Code:
    protected override void OnExecution(IExecution execution)
            {
    			if (entryOrder != null && entryOrder == execution.Order)
    			{
    				if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
    				{
    					if(StopLoss >= Close[0]) 
    					{ 
    						stopOrder = ExitLongStop(0, true, DefaultQuantity, Close[0] - 1*TickSize, "stop bad", "Long Entry");
    						targetOrder = ExitLongLimit(0, true, DefaultQuantity, ProfitTarget, "target bad", "Long Entry");
    						
    						stopOrder = ExitLongStop(0, true, DefaultQuantity, Close[0] - 1*TickSize, "stop bad", "Long Entry bad");
    						targetOrder = ExitLongLimit(0, true, DefaultQuantity, ProfitTarget, "target bad", "Long Entry bad");
    						
    						DrawDot("stop bad", true, 2, Close[0] - 1*TickSize, Color.Orange); 
    						DrawDot("target bad", true, 2, ProfitTarget, Color.Blue);
    						
    						badorders = badorders + 1; 
    						Print("Close >= OrderPrice, badorders # = " + badorders.ToString());
    						
    					}
    Maybe because it doesn't work in "OnExecution()"?
    And if yes, how to draw dot for Stop Loss and Profit Taking orders?

    #2
    Hi Alexstox,

    Thank you for posting.

    Do you receive any errors in the Log Tab of the Control Center?
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      After your post I just rerun NT and everything OK. I don't know what why it didn't work earlier?!

      Log and trace files are OK.

      Comment


        #4
        Alexstox,

        You would need to see if you can reproduce the error of it's not working the way you expect it too.
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          I import script from PC to notebook. First run shown that everything is OK. I don't know what was that. Thanks!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by frankthearm, Today, 09:08 AM
          7 responses
          29 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by NRITV, Today, 01:15 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by maybeimnotrader, Yesterday, 05:46 PM
          5 responses
          25 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by quantismo, Yesterday, 05:13 PM
          2 responses
          17 views
          0 likes
          Last Post quantismo  
          Started by adeelshahzad, Today, 03:54 AM
          5 responses
          33 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Working...
          X