![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Dec 2008
Posts: 61
Thanks: 0
Thanked 0 times in 0 posts
|
I'm trying to get the value of the TSSuperTrend indicator as:
super_trend = TSSuperTrend(Median,14,HMA,2.618,14,ATR)[0]; or super_trend = TSSuperTrend(14,HMA,2.618,14,ATR)[0]; The first method is as it is called as an indicator. The second is the method shown by the compiler. The compiler gives me the error message in the attached jpg. The error relates to the HMA and ATR calls. How can I make this work? Thanks! Larry |
|
|
|
|
|
#2 |
|
Certified NinjaScript Consultant
|
include the following line at the top of your script:
using TradingStudies.NinjaScript.Utility; and replace HMA with MovingAverageType.HMA replace ATR with SuperTrendMode.ATR |
|
|
|
|
|
#3 |
|
Member
Join Date: Dec 2008
Posts: 61
Thanks: 0
Thanked 0 times in 0 posts
|
Roonius,
Thanks very much! I appreciate the help! It seems, to me anyway, that there are many nooks and crannies hidden in NT that make it hard for a "Level 2 player" to navigate through the code, like this one. Is there a reference that exposes more of the hidden areas? Thanks again! Larry |
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Larry,
This is not NinjaTrader specific. It is due to the 3rd party code you are using and as such usage can vary depending on who writes it.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Dec 2008
Posts: 61
Thanks: 0
Thanked 0 times in 0 posts
|
Josh and Roonius,
I appreciate the help! The next baby step involves what seems to be memory leakage when I call the indicator from my strategy. I load the two values of the lines and the bool trend into my strategy from: up_trend = TSSuperTrend(14,MovingAverageType.HMA,2.618,14,Sup erTrendMode.ATR).UpTrend[0]; down_trend = TSSuperTrend(14,MovingAverageType.HMA,2.618,14,Sup erTrendMode.ATR).DownTrend[0]; trend_up = TSSuperTrend(14,MovingAverageType.HMA,2.618,14,Sup erTrendMode.ATR).Trend[0]; These are inside a "if (FirstTickOfBar)" statement, so I only get these once per bar. With these statements included in my strategy, it takes my i7 3GHz CPU with 3GB RAM running Vista about 30 seconds to load my strategy with 5 minute candles and 15 days of historical data. Without the statements, it takes the machine less than a second to load the strategy. The instructions consume about 500MB of additional RAM. I can watch the available memory disappear as the strategy is attempting to load. If I recompile and reload the strategy, the first load does not release the memory it took. The second load continues to take memory until I get an "out-of-memory" message. The TSSuperTrend indicator has remarkable potential when used in a momentum based strategy. I don't think I can use it as is imagining money on the table and the computer running out of memory. ![]() Is there a reason for the high memory use when the indicator variables are ported into a strategy? Am I doing something that causes this? Can it be stopped? Thanks again very much! Larry
Last edited by epcompany; 05-30-2009 at 08:30 AM.
|
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
|
Hello,
I will have Josh reply on Monday.
Ben
NinjaTrader Customer Service |
|
|
|
|
|
#7 | |
|
Certified NinjaScript Consultant
|
Quote:
Will keep you updated as soon as I find the solution |
|
|
|
|
|
|
#8 |
|
Certified NinjaScript Consultant
|
|
|
|
|
|
|
#9 |
|
Member
Join Date: Dec 2008
Posts: 61
Thanks: 0
Thanked 0 times in 0 posts
|
Roonius,
Thank you very much for V2.1! I ran it all weekend starting and stopping and recompiling, etc. After a VERY long (comparative) time, my machine bogged down with memory problems but this version is far superior to the previous version in terms of memory usage. It is now useful and trust worthy for real-time trading. I appreciate it and you! I'm sure you understand the power of your indicator relative to price movement: it indicates when you have an advantage trading, it tells you when to stay out, and it is tunable for one's personal risk tolerance. I combined your indicator with PSAR and have made a very powerful trading tool. I hope to owe you a dinner for you and a guest at the Top of the Mark in SF by-and bye. ![]() ![]() ![]() Larry PS: One other item. If I call the indicator for bar [0], it returns zero for the two trend values and false for the trend. I only get legitimate values if I run it from bar [1]. I call it on the first tick of bar [0]. If I could push the values up one bar to bar [0], that would be even better. Here are the strategy lines: up_trend_value = TSSuperTrend(14,MovingAverageType.HMA,2.618,14,SuperTrendMode.ATR).UpTrend[1]; down_trend_value = TSSuperTrend(14,MovingAverageType.HMA,2.618,14,SuperTrendMode.ATR).DownTrend[1]; trend_up_indicator = TSSuperTrend(14,MovingAverageType.HMA,2.618,14,SuperTrendMode.ATR).Trend[1]; |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SuperTrend strategy (TSSuperTrend) | sam028 | NinjaScript File Sharing Discussion | 3 | 06-03-2009 07:17 AM |
| Compile error | mktrend | General Programming | 3 | 01-07-2009 05:28 AM |
| Will not compile | latkinso | Indicator Development | 1 | 06-26-2008 01:52 PM |
| Can't Compile Indicator | garciaal | Indicator Development | 1 | 07-15-2007 11:30 PM |
| try to compile but | Elmi | Indicator Development | 1 | 11-05-2006 01:40 AM |