Announcement

Collapse
No announcement yet.

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 Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          580 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          334 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          554 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X