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:
But it doesn't seem to pick up any clicks from the mouse, even though on an Indicator it does (but I can't use an Indicator since I can't place orders on them).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 Files
- Likes 2
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
43 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
21 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
30 views
1 like
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
50 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
41 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment