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 NullPointStrategies, Today, 05:17 AM
|
0 responses
49 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
126 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
67 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
42 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
46 views
0 likes
|
Last Post
|

Comment