Here is a screenshot of that exact code, running realtime in the market since the open this morning. (Sim account, connected to realtime quotes from CQG).
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Help with simple strategy
Collapse
X
-
Well, you are going to have to sort out what you are actually doing. As I said, what you describe is impossible.Originally posted by [email protected] View Post
Here is a screenshot of that exact code, running realtime in the market since the open this morning. (Sim account, connected to realtime quotes from CQG).
-
Let us see a picture of the chart showing all these trades, if you will.Originally posted by [email protected] View PostI am sorry if it seems like I am asking repetitive dumb questions - I am legitimately trying.
Yes I am 100% certain that I am not running any old code.
In the past I was editing a previous version just updating the changes. I just created a new file that never had any of the old code in their making sure to only put in exactly what was relevant.
edit:
Yes I am hitting the compile button, then I hit the save button, then I reload the strategy onto the chart after any changes - I learned that last week
It did the exact same as before, entering at 92.09, and then oscillating positions at 92.18 :/
Sorry to seem such a bother
Comment
-
So after a near tornado storm forced me to turn my computer off, I started up ninjatrader again. This time I tried running it on a range chart and the rising half of the code was working! So I went ahead and typed in the other half of the code for falling price and ran it on a 5 range chart. It seems to be working fine. I then went ahead and started the strategy on a minute bar chart and it worked much better then before! Maybe I guess it just needed my computer to be restarted as I did nothing different then what I had been trying before!
However it still started oscillating positions on the minute chart after a number of reversals (see attached picture). I went back to a range chart and ran a couple days of replay data and have had no issues yet on that.
I am hypothesizing that perhaps the code does not like multiple reverses in the same bar. Whereas on a range chart with a smaller range then the reverse it would not happen but on a minute chart it is possible? But even then there are some bars with multiple reversals in it that are fine.
Thankyou so much for your help!
Comment
-
Your hypothesis is likely correct, but it is impossible to say for certain, as the data that you have provided is somewhat incomplete. Naturally, however, on a 5-range chart, it would be impossible to trigger both levels on a single bar, given that the levels are, at a minimum, 10 ticks away from each other. With minute bars, depending on the range of a bar, both levels can be breached.Originally posted by [email protected] View PostSo after a near tornado storm forced me to turn my computer off, I started up ninjatrader again. This time I tried running it on a range chart and the rising half of the code was working! So I went ahead and typed in the other half of the code for falling price and ran it on a 5 range chart. It seems to be working fine. I then went ahead and started the strategy on a minute bar chart and it worked much better then before! Maybe I guess it just needed my computer to be restarted as I did nothing different then what I had been trying before!
However it still started oscillating positions on the minute chart after a number of reversals (see attached picture). I went back to a range chart and ran a couple days of replay data and have had no issues yet on that.
I am hypothesizing that perhaps the code does not like multiple reverses in the same bar. Whereas on a range chart with a smaller range then the reverse it would not happen but on a minute chart it is possible? But even then there are some bars with multiple reversals in it that are fine.
Thankyou so much for your help!
Now comes the part where you refine your code to ensure that things go the way that you really want. Remember that the 'puter is just a stupid machine that can count extremely fast, store its state, and reference that state to adjust its state. It will do as you say, not as you intend.
Back to refining the technical spec. is your next step. Typically, you would define what you want to do if you get opposing signals on the same bar, then code it. That is something that you have decide for yourself, just as each of us has to do.
Maybe, you also now understand why I insist that Range Bars are the most sensible to trade off of?
Comment
-
Heh, clearly I needed to start coming here sooner!Originally posted by koganam View PostMaybe, you also now understand why I insist that Range Bars are the most sensible to trade off of?
What more data would I need to put up so that we could verify the hypothesis?
A range bar also has a clear advantage in the way the data is represented and to see how the reverses happen in comparison with some of the longer range minute charts. Anyways what I am wondering then if there isnt a way to take the SMA from the minute chart and put it onto the range chart, more importantly put it into the strategy that is running on the range chart.
To state it clearly for our purposes
: to draw from a minute chart the sma for the strategy that is run on the range chart.
Guess I got to go do some reading!
Comment
-
You would have to write a multi-timeframe strategy, which, come to think of it, is what you have described anyway.Originally posted by [email protected] View Post... Anyways what I am wondering then if there isnt a way to take the SMA from the minute chart and put it onto the range chart, more importantly put it into the strategy that is running on the range chart.
To state it clearly for our purposes
: to draw from a minute chart the sma for the strategy that is run on the range chart.
Guess I got to go do some reading!
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
633 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
364 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
105 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
567 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
568 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment