private double lastValue; protected override void OnRender(ChartControl chartControl, ChartScale chartScale) { Point cursorPoint = chartControl.MouseDownPoint; if (chartScale.GetValueByYWpf(cursorPoint.Y) != lastValue) { Print(String.Format("Mouse clicked at price {0}", chartScale.GetValueByYWpf(cursorPoint.Y))); EnterLongStopMarket(lastValue, "long"+CurrentBar.ToString()); } lastValue = chartScale.GetValueByYWpf(cursorPoint.Y); }
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Strategy not picking up OnRender() method
Collapse
X
-
Strategy not picking up OnRender() method
I am trying to make a Strategy that enters a long order every time I click on a price:
Code:Tags: None
-
Welcome to the forums daigo1!
The OnRender code works, but you are not checking for any mouse clicks before submitting the order. When I test, an order is submitted immediately and then the strategy disables because of an order being submitted to an invalid price.
I have attached an example strategy that can demonstrate using mouse clicks to submit orders.
We look forward to assisting.Attached FilesJimNinjaTrader Customer Service
- 2 likes
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by pjsmith, Today, 01:00 AM
|
1 response
10 views
0 likes
|
Last Post
![]()
by NT-Roland
Today, 01:19 AM
|
||
Started by alejandro888, Yesterday, 08:41 PM
|
0 responses
9 views
0 likes
|
Last Post
![]()
by alejandro888
Yesterday, 08:41 PM
|
||
Started by UltraNIX, Today, 02:14 AM
|
0 responses
5 views
0 likes
|
Last Post
![]()
by UltraNIX
Today, 02:14 AM
|
||
Started by augustfay, Yesterday, 12:06 PM
|
1 response
13 views
0 likes
|
Last Post
|
Comment