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
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!
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
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
- Likes 2
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Dr Kerry, Today, 02:03 AM
|
0 responses
2 views
0 likes
|
Last Post
by Dr Kerry
Today, 02:03 AM
|
||
Started by AndriXF7, 12-06-2023, 10:09 AM
|
5 responses
160 views
1 like
|
Last Post
by Lunorri
Today, 01:56 AM
|
||
Started by rosa2013, Today, 01:47 AM
|
0 responses
1 view
0 likes
|
Last Post
by rosa2013
Today, 01:47 AM
|
||
Started by owenany, Today, 01:25 AM
|
0 responses
1 view
0 likes
|
Last Post
by owenany
Today, 01:25 AM
|
||
Started by BigRay, 04-07-2023, 05:41 PM
|
2 responses
658 views
1 like
|
Last Post
by 2inthebush
Today, 01:10 AM
|
Comment