View Full Version : Signal from one instrument order on another
Captain Haddock
10-17-2007, 05:27 PM
Is it possible to recieve a signal from one instrument and make a trade on another?
I have looked at the multiinstrument example, but can't work out how it checks one instrument.
EG: a simple SMA cross on the ES sends a buy/sell signal to the YM at that moment?
TIA
NinjaTrader_Ray
10-17-2007, 06:45 PM
Yes, absolutely. You would run a strategy on the YM chart and then in initialize you would add:
Add("ES 12-07", PeriodType.Minute, 1);
Then in OnBarUpdate() you could do something like -
if (BarsInProgress == 0)
{
if (CrossAbove(SMA(BarsArray[1], 5), SMA(BarsArray[1], 20), 1))
EnterLong();
}
Captain Haddock
10-18-2007, 05:20 AM
Thanks RAY
Captain Haddock
10-18-2007, 04:58 PM
Hi Ray, Is it possible to use the median for the SMA calculation?
Appreciate your help.
NinjaTrader_Ray
10-18-2007, 06:55 PM
Yes.
if (BarsInProgress == 0)
{
if (CrossAbove(SMA(Medians[1], 5), SMA(Medians[1], 20), 1))
EnterLong();
}