PureBytes Links
Trading Reference Links
|
> Hi Victor,
> Thanks for your efforts, but the code will not verify???
I think Victor was doing like I sometimes do, whipping it out off the
top of his head, and letting you do the testing. :-)
> You will want to set up one chart with the S&P as
> data1, the S&P index as Data2 and the NASDAQ 100 as
> Data3. Then you can apply this system to it:
> If Close[1] of Data2 then
> value1 = Close of data2 / Close[1] of Data2;
> If Close[1] of Data3 then
> value2 = Close of data3 / Close[1] of data3;
He probably intended to say "if Close[1] of DataX <> 0 then ..."
He's checking to make sure you don't divide by zero. That's always a
good idea. Maybe you think the price will never hit zero, but in
some corner cases TS uses a zero value when the data is missing.
After that, value1 has the 1-bar %change in SPX, and value2 has the 1-
bar %change in NDX.
> If value2 > value3 then
> buy next bar at open
> else
> sell next bar at open;
Change that to "if value2 > value1" and it should work as he intended.
(Another case where declaring named variables would avoid a sneaky
error. :-)
Gary
|