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 RoswellTrader, 09-06-2023, 03:00 PM
|
7 responses
595 views
0 likes
|
Last Post Today, 07:58 AM | ||
Started by chris07, Today, 07:37 AM
|
1 response
6 views
0 likes
|
Last Post Today, 07:54 AM | ||
Started by sevensa, 03-14-2024, 10:15 PM
|
4 responses
34 views
0 likes
|
Last Post Today, 07:49 AM | ||
Started by AndriXF7, 12-06-2023, 10:09 AM
|
6 responses
174 views
1 like
|
Last Post Today, 07:28 AM | ||
Started by henryd333, 03-22-2021, 08:18 AM
|
19 responses
932 views
0 likes
|
Last Post Today, 07:18 AM |
Comment