Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Auto Trend Line
Collapse
X
-
Auto Trend Line
I am trying to write a simple buy and sell system based on AutoTrendLine indicator. The system will simply buy and sell based on buy and sell arrows produced by the AutoTrendLine indicator. I have no programming skills and have not been successful using the Wizard. The AutoTraendLine code seems to have a Signal=1 for a buy and Signal=2 for a sell. When used in the system code as an IF statement to initiate a long possition on Signal=1 and a short position on Signal=2, it will not work (or compile). I know I must be missing something, but don't know what. Is there such a system already out there? Any help is appreciated.Tags: None
-
Bertrand,
Thanks a bunch, you snippet compiled fine.
It does triger buys and sells, however, they seem to be random (at least to me) and occur in all directions. I am not sure what is wrong. What I really want the code to do is to trigger longs and shorts on break of the trend line when AutoTrendLine indicator generates a buy or sell signal and wait for the next trend line break to make another trade, if flat.
Attached is the revised file with your suggested changes.
Thanks.Attached Files
Comment
-
aligator, it would trigger on breaks of the trendline, as usual those methods would produce likely whipsaws before catching the run so you may need additional rules as well to be more consistent.
I could unfortunately not take a look at your code, as the archive seems corrupted, can you please reattach it?
Thanks
Comment
-
Thanks Bertrand for you quick responses. The file opens for me and runs, don't know what is corrupted. Attached are both the .zip and .cs files.
Thanks again.
Comment
-
I'm sorry to butt in, and I have a shameless plug -- my ProTradingTools code will allow you to get signals and trade off of our auto trendline indicator. There's a 30 day free trial if you want to try it. We're still kind of developing the software, so your input would certainly be appreciated and we could possibly modify it for you.
Bryan
Comment
-
you're welcome - first of all you would need to ensure to run the same parameters in the indicator and strategy (strength), next you might need to more clrearly define what a trend line break constitutes for you - perhaps enter by Stop / StopLimit order a few ticks above / below the signal bar to filter 'fakes'.Originally posted by aligator View PostThanks Bertrand for you quick responses. The file opens for me and runs, don't know what is corrupted. Attached are both the .zip and .cs files.
Thanks again.
Comment
-
The AutoTrendLine works well as an indicator.... Anyone know how to code it to stay short while the line is Down (RED) and stay long while the Line is up (Green) this would be much more consistent than trying to catch trend breaks..... going WITH the prevailing trend basically.......
Comment
-
AutoTrend with Historical Lines
Alagator, Heres something that might help you.
I've modified the AutoTrend indicator (now AutoTrendH) so that it now shows historical trend lines (you can see past trendline crossings and so see why the trades occured when they did). In addition I have written a basic AutoTrendH strategy using this indicator. I have tried to structure the strategy so that you can follow it can be easily modified with additional strategy elements.
Download HereLast edited by derekphelps; 12-16-2012, 05:33 PM.
Comment
-
Hi Derek,Originally posted by derekphelps View PostAlagator, Heres something that might help you.
I've modified the AutoTrend indicator (now AutoTrendH) so that it now shows historical trend lines (you can see past trendline crossings and so see why the trades occured when they did). In addition I have written a basic AutoTrendH strategy using this indicator. I have tried to structure the strategy so that you can follow it can be easily modified with additional strategy elements.
Download
Excellent indicator! I found a bug. When you turn off history trendlines the dots is not turned off.
Comment
-
-
Hello JamesBond,
Thank you for writing in. Please navigate to Tools -> Edit NinjaScript -> Indicator -> AutoTrendH -> OK
In the code editor, change the value on line 45 to increase the width of the lines:
A value of 2 would give slightly thicker lines and a value of 5 would give significantly thicker lines.Code:private int lineWidth = 1;
Then press F5 on your keyboard to compile and save the changes.
Please let me know if I may be of further assistance.Michael M.NinjaTrader Quality Assurance
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
558 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
324 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
545 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment