For example, if i want to fire off a trade in the ES or YM each time the $TICK chart moves a certain way how would I do that. I understand a lot about ninja script but don't have any idea how to reference multiple charts in a strategy or if its even possible.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Trade based on 2nd chart
Collapse
X
-
Trade based on 2nd chart
Just wondering if it is possible to execute a trade on one market/chart from another.
For example, if i want to fire off a trade in the ES or YM each time the $TICK chart moves a certain way how would I do that. I understand a lot about ninja script but don't have any idea how to reference multiple charts in a strategy or if its even possible.Tags: None
-
first of all thank you very much for your help, it works fantastic.
However there is one other thing I'm wondering if it is possible. Can I have an automated program like this stop executing once it hits x number of targets or stop losses?
For example say I want it to not trade anymore until I restart it once it gets stopped out three times in a row. Will it remember something like a counting variable as it continues to make trades? If it does, is there a simpler way than doing something like:
when position is not flat checking if the close[0] is == to stop add one to the stopped out variable. Once stopped out if variable is > 2 it will not be able to reach the trading code.
PS my automator calculates intrabar
Comment
-
That's good to know this is doable, but I should have asked more specifically how do I know (in my code) that it has hit a stop?
also, i can't find anything on timers. I know how to exit a position at a specific time, but is is possible to exit after a trade has been active for 30mins?Last edited by shazzmoe; 02-16-2010, 10:50 AM.
Comment
-
shazzmoe, please see the reference titled monitoring stop-loss and profit-target orders for your first question. As for the timer, this reference sample goes over custom events and timer objects. You could also use BarsSinceEntry() if using minute-based bars.AustinNinjaTrader Customer Service
Comment
-
First of all thanks again for all your support, I now have a program that should do exactly what I want it to do.
However I have noticed that when I place the automator on a chart it automatically runs through the past data. For example, I have it to stop trading after X number of trades. But because It looks at the past data it starts out thinking it has done all its trades and thus will never trade. When I set my chart to not go back more than 40 bars (when there have been no acceptable trades) it outputs the correct variables for me and I'm assuming will trade properly at this point.
Is there a way to prevent this? I would really like my chart to look back more than a couple bars if possible.
Comment
-
shazzmoe,
Whenever you run a strategy it will always look through all your historical bars as if it were real-time bars for processing.
If you want to prevent historical processing but still have historical bars, add this to the beginning of OnBarUpdate().
Code:if (Historical) return;
Josh P.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by WHICKED, Today, 12:45 PM
|
1 response
10 views
0 likes
|
Last Post Today, 01:08 PM | ||
Started by samish18, Today, 01:01 PM
|
0 responses
5 views
0 likes
|
Last Post
by samish18
Today, 01:01 PM
|
||
Started by WHICKED, Today, 12:56 PM
|
0 responses
8 views
0 likes
|
Last Post
by WHICKED
Today, 12:56 PM
|
||
Started by Spiderbird, Today, 12:15 PM
|
2 responses
11 views
0 likes
|
Last Post
by Spiderbird
Today, 12:48 PM
|
||
Started by FrazMann, Today, 11:21 AM
|
2 responses
8 views
0 likes
|
Last Post Today, 12:38 PM |
Comment