Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Can't run backtest
Collapse
X
-
Hello madmoney5,
Thank you for your post and welcome to the NinjaTrader Support Forum!
So I may investigate this matter further please answer the following questions.
Who are you connected to? This is displayed by green on lower left corner of the Control Center window.
What instrument(s) have you selected? If a futures instrument, what expiry is selected? (Example: ES 09-15)
What interval and period type is selected for the backtest? (Example: Tick, Minute, Day, etc.)
I look forward to your response.Riley S.NinjaTrader Customer Service
-
1) Connected to end of day Kinetick, just to try and run backtests
2) SP 500, I only want to trade stocks above 5.00
3) Timeframe is default 1/1/15 to 7/16/15
4) Ok I just change it from default minute to day, which at least allowed me to run the backtest and get an error
Error on loading chart data for WLP Default Unable to load historical data
Error on loading chart data WAG Default
Error on loading chart data NU Default
I am trying to test a simple pullback strategy for S&P 500
Comment
-
Ok, so the errors look like they pertain to issues with historical data per symbol, not a big deal.
I am looking at results, they look good, now I want to make a couple changes.
1) I want to always make trades of 20% or 1/5 of account or know how to adjust
2) How do I trade only stocks above $5.00?
3) How do I prioritize trades by taking only 5 positions at a time and only taking the weakest 1 week relative strength?
Comment
-
Hello madmoney5,
I have provided sample code snippets below to accomplish the questions you are asking for through NinjaScript. Please note that we do not provide programming services.
- This logic will enter a long with an amount of trades that would be equivalent to ~20% of your account value:
Code:int quantity = (int)(GetAccountValue(AccountItem.BuyingPower) * .2) / Close[0]); EnterLong(quantity);
- This conditional checks if the price of the current instrument is above 5 and will enter a long if it is:
Code:if (Close[0] > 5) { EnterLong(); }
- I would need further clarification on this one. What would define a value as "weak" and how do you personally define it as the "weakest"?
Zachary G.NinjaTrader Customer Service
Comment
- This logic will enter a long with an amount of trades that would be equivalent to ~20% of your account value:
-
OK, the close greater then 5, I figured out, I just need to put it in manually as used defined.
Lowest 1 week relative strength would be priority on the buy list, of only 5 maximum trades at any one time.
So if there are 10 trades that meet my requirement at the end of the day or morning, it would only pick the 5 lowest 1 week relative strength, if that makes sense.
Thank you very much for helping me, I greatly appreciate it.
Comment
-
Ok you might not be able to answer the prioritize the trades because I might need to hire a programmer. Another question I have.
1) How do I get the strategy to exit the trade at the close of day 5 no mater what. I entered a user input of 5 for time, but having trouble figuring out how to get that into set two to exit or close the trade?
Comment
-
Originally posted by madmoney5 View PostOK, the close greater then 5, I figured out, I just need to put it in manually as used defined.
Lowest 1 week relative strength would be priority on the buy list, of only 5 maximum trades at any one time.
So if there are 10 trades that meet my requirement at the end of the day or morning, it would only pick the 5 lowest 1 week relative strength, if that makes sense.
Thank you very much for helping me, I greatly appreciate it.
You would need to add each instrument to your strategy in order for the strategy to look over the instruments you would like to use.
To do this, you would use the Add() method call. For further information on using the Add() method call, please take a look at the NinjaTrader help guide at this link: http://ninjatrader.com/support/helpGuides/nt7/?add3.htm
For further information about multiple instruments and time frame use in NinjaScript, please take a look at this link in the NinjaTrader help guide: http://ninjatrader.com/support/helpG...nstruments.htm
Originally posted by madmoney5 View PostOk you might not be able to answer the prioritize the trades because I might need to hire a programmer. Another question I have.
1) How do I get the strategy to exit the trade at the close of day 5 no mater what. I entered a user input of 5 for time, but having trouble figuring out how to get that into set two to exit or close the trade?
You can use a variable to get the date when your order was filled and then check the date compared to the number of days that you want to close it out on.Zachary G.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by carnitron, 03-25-2024, 01:59 PM
|
11 responses
49 views
0 likes
|
Last Post
by carnitron
Today, 02:18 PM
|
||
Started by Gerik, 12-21-2023, 08:20 AM
|
15 responses
202 views
0 likes
|
Last Post
by Mindset
Today, 02:06 PM
|
||
Started by visvabalaji, Today, 02:04 PM
|
0 responses
3 views
0 likes
|
Last Post
by visvabalaji
Today, 02:04 PM
|
||
Started by spottysallrite, Today, 11:31 AM
|
6 responses
14 views
0 likes
|
Last Post Today, 01:53 PM | ||
Started by volIQ, Yesterday, 04:28 PM
|
2 responses
16 views
0 likes
|
Last Post
by volIQ
Today, 01:42 PM
|
Comment