Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
What is the best way to visually backtest an indicator? Is there some marking arrow function which will stamp the price on the chart? I know it's rather rudimentary but I have no programming skills to work with so this is the best I can do for now.
Can you help answer these questions from other members on NexusFi?
Not sure how much of an explanation you wanted, but here is a very BASIC way to accomplish what you want and is a very simple example.
If you wanted to do this, you would need to create an arrow via NT script to plot based on some conditions you want to test. For example if you wanted to test a MACD crossing above 0, you would write a script with the following lines of code:
That is just the entry. Say you wanted to exit when the MACD crosses back below 0. I like to plot a different chart marker for my exits so I use an opposing direction triangle. You would add this line of code:
You could also print the closing price of the bar with the arrow there by appending the first statement above with this "DrawText" line to print the price so it will be easier to see:
You also want to set a flag so that your script knows weather or not a trade has been triggered.... but for the purposes of this example, since we are just using the 0 crossing of an oscillator, it knows long if above zero, and flat if below.
Attached is what that looks like on a chart.
peglegtrading
ho chi minh city
Posts: 52 since Mar 2011
Thanks Given: 16
Thanks Received: 9
Basically why I ask is that I want to create a visual backtest using the following indicators when they are in trend mode. The reason I ask just for a visual backtest is that I am not sure if the past two days are extremely trendy or if I found some really sweet combination of entries and exits.
When they are all signalling together just follow the trend.
Huge results the past two days.
forrestang
Chicago IL
Urban Samurai
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
Posts: 1,336 since Jun 2010
Thanks Given: 354
Thanks Received: 1,049
Well, as far as programming this goes, you would have to be more specific on how you want these things to work.
Initially it sounded like you wanted explicit entry/exit signals painted on your chart?
It sounds like now what you are wanting is more of a 'trendMeter' of sorts based on those 3 indicators being up or down.
But at any rate, you would need to provide more definition on what conditions EACH of these 3 indicators would be displaying individually, that would make up the sum of your trend definition.
peglegtrading
ho chi minh city
Posts: 52 since Mar 2011
Thanks Given: 16
Thanks Received: 9
Yes, it seems my original idea is much more about an indicator than a "backtest." Apologies for being so vague.
As you can see from the screenshot, if the heiken ashi bar is red, the adx indicator is blue and the ema slope bars are red, that would be a good time to short.
For long the Heiken Ashi would be Yellow, the Adx blue and the EMA Slope Green.
I actually tried to do this in strategy mode using the bool command (these are all true false conditions) but I got stopped at the beginning when it asked for the input series and I didn't know how to tell it what to do.
Anyways, I feel like I should pay someone to do this or at least find someone to pay to teach me, this seems like awfully tedious work for someone who actually knows how to program on ninjatrader.
forrestang
Chicago IL
Urban Samurai
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
Posts: 1,336 since Jun 2010
Thanks Given: 354
Thanks Received: 1,049
This isn't complicated at all to accomplish. Post the links to the indicators you are currently using so that I can download the ones you are using.
peglegtrading
ho chi minh city
Posts: 52 since Mar 2011
Thanks Given: 16
Thanks Received: 9
I have gone ahead and pm'd you the indicators as one of them cannot be found on the elite section but I am almost certain I found it there.
I think the big deal about this combination is that it has 2 indicators which deal with nothing but avoiding chop. Not that they avoid it but they seem to put the odds in your favor when you trade high volume times of day (or night in my case).
Also keep in mind that the signal for the bar must be in alignment with the trend. So if it's a buy signal the close of the signal bar should be bullish (a close higher than it opens) and reversed for a bearish signal. The OHLC bars are extremely useful for alerting us to this.
Although I am completely new to NinjaTrader I have been with Metatrader for more than 5 years so I have a pretty good idea about trading Forex. I am really tired of bad brokers though so I am trying to transition to a more open market, namely futures markets.
forrestang
Chicago IL
Urban Samurai
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
Posts: 1,336 since Jun 2010
Thanks Given: 354
Thanks Received: 1,049
So do you want an up arrow on the chart when all these conditions are true and vice versa for a short?
Or do you want a meter of sorts that for example is green when all of these conditions are true and red for short?
You have defined so far to trend states.... either up where all of these conditions are true, and dn when the reverse of these conditions are true.
If say two of 3 of these criteria are true, does this put it into a third state where say the trend meter would be yellow?
Do this, mark up a chart with these indicators of what you want to see on your chart with the indicators on them when your conditions are met.
Either you plot an arrow, or you just have a meter on the bottom of the price panel showing the color of your desired state.