March 2007
TRADERS' TIPS


Here is this month's selection of Traders' Tips, contributed by various developers of technical analysis software to help readers more easily implement some of the strategies presented in this and other issues.

You can copy these formulas and programs for easy use in your spreadsheet or analysis software. Simply "select" the desired text by highlighting as you would in any word processing program, then use your standard key command for copy or choose "copy" from the browser menu. The copied text can then be "pasted" into any open spreadsheet or other software by selecting an insertion point and executing a paste command. By toggling back and forth between an application window and the open Web page, data can be transferred with ease.

This month's tips include formulas and programs for:

AMIBROKER: MOVING AVERAGE CROSSOVERS (PART II)
TRADESTATION: MOVING AVERAGE CROSSOVERS (PART II)
eSIGNAL: MOVING AVERAGE CROSSOVERS (PART II)
METASTOCK: MOVING AVERAGE CROSSOVERS (PART II)
WEALTH-LAB: MOVING AVERAGE CROSSOVERS (PART II)
NEUROSHELL TRADER: MOVING AVERAGE CROSSOVERS (PART II)
SNAPSHEETS: MOVING AVERAGE CROSSOVERS (PART II)
NEOTICKER: MOVING AVERAGE CROSSOVERS (PART II)
AIQ: MOVING AVERAGE CROSSOVERS (PART II)
TRADECISION: MOVING AVERAGE CROSSOVERS (PART II)
STRATASEARCH: MOVING AVERAGE CROSSOVERS (PART II)
TRADINGSOLUTIONS: MOVING AVERAGE CROSSOVERS (PART II)
VT TRADER: MOVING AVERAGE CROSSOVERS (PART II)

or return to March 2007 Contents


AMIBROKER: MOVING AVERAGE CROSSOVERS (PART II)

The article by Dimitris Tsokakis in this issue, "Moving Average Crossovers (Part II)," already includes code for AmiBroker in the article's sidebar. Here, we demonstrate how to avoid repetitive coding and make formulas much shorter by using loops and user-defined functions. I'll use the last formula from the article, "Stochastic Sma Crossover Predictions Statistics," to illustrate, since it contains many repetitions that can be easily eliminated.

This code listing shows a functionally equivalent formula that is half the size of the original. We use a single "for" loop and one user-defined function called "OutputColumns" to achieve this. Gains achieved by proper structure of the code and the use of looping grow with complexity of the task and make structured code easier to maintain in the future.
 

Stochastic Sma Crossover Predictions Statistics
C1=StochD();
p = 20;
MAp = MA( C1, p );
k = 30;
MAk = MA( C1, k );
TC1 = (p*(k-1)*MA(C1,k-1)-k*(p-1)*MA(C1,p-1))/(k-p);
DescCrossPrediction = Cross( TC1, C1 );
AscCrossPrediction = Cross( C1, TC1 );
ConfirmedDesc = Cross( MAk, MAp );
ConfirmedAsc = Cross( MAp, MAk );
DescTotalPredictions = Cum( DescCrossPrediction );
AscTotalPredictions = Cum( AscCrossPrediction );
function OutputColumns( CrossPred, Confirmed, TotalPred, Text )
{
   AddColumn( TotalPred,"Total # of " + Text + " Predictions",1.0);
   TotalDesc = 0;
   for( i = 0; i <= 3; i++ )
   {
      temp = Ref( CrossPred, -i);
      npred = Cum( Confirmed AND temp );
      Colname = WriteIf( i == 0, "Useless " + Text + " %",
               StrFormat("Acc%g "+ Text + " %%", i - 1 ) );
      Desc = 100 * npred / TotalPred;
      AddColumn( Desc, colname, 1);
      TotalDesc = TotalDesc + Desc;
   }
   AddColumn(100-TotalDesc,"False " + Text + " %",1.0);
}
Filter = Status("lastbarinrange");
OutputColumns( DescCrossPrediction, ConfirmedDesc, DescTotalPredictions, "Desc" );
OutputColumns( AscCrossPrediction, ConfirmedAsc, AscTotalPredictions, "Asc" );


--Tomasz Janeczko, AmiBroker.com
www.amibroker.com

GO BACK

TRADESTATION: MOVING AVERAGE CROSSOVERS (PART II)

In this issue, Dimitris Tsokakis presents his second installment on anticipating moving average crossovers in "Moving Average Crossovers (Part II)." In it, Tsokakis characterizes trading opportunities based on the probability that a crossover will occur.

The following EasyLanguage code translates Tsokakis' indicator described in the sidebar "Probable SMA Cross Days" into EasyLanguage. This indicator classifies each bar into one of four categories. In the first, a cross is unlikely. In the second, a cross is probable. In the third, a cross is expected. Finally, there are actual crosses. (See Figure 1.)

FIGURE 1: TRADESTATION, PROBABLE SMA CROSS DAYS. Four kinds of bars are distinguished by Dimitris Tsokakis' method. Thin gray bars mark where a cross is unlikely. Yellow-red or yellow-green bars mark bars on which a cross is probable. Solid green or magenta bars are those on which a cross is expected. A large dot marks the bars on which actual crosses occurred.

 

To download this code, go to the Support Center at TradeStation.com and search for the file "Tsokakis2.Eld."

TradeStation does not endorse or recommend any particular strategy.

Indicator:  ProbableSMACrossDays
 

inputs:
    p( 20 ),
    k( 30 ),
     UnlikelyColor( LightGray ),
    ExpectBearCross( Yellow ),
    ExpectBullCross( Yellow ),
    BullCrossNext( DarkGreen ),
    BearCrossNext( Magenta ),
    BullCross( Green ),
    BearCross( Red ) ;
variables:
    MAp( 0 ),
    MAk( 0 ),
    kLess1( 0 ),
    MAkLess1( 0 ),
    pLess1( 0 ),
    MApLess1( 0 ),
    TC( 0 ),
    DescCrossPrediction( false ),
    AscCrossPrediction( false ),
    ExpectMACross( false ),
    Confirmed( false ),
    ROC( 0 ),
    HalfUpperRange( 0 ),
    HalfLowerRange( 0 ),
    Ucoeff( 0 ),
    Lcoeff( 0 ),
    Unlikely( false ),
    NotUnlikely( false ),
     BarsSinceCross( 0 ),
    NotExpectMACross( false ),
    NotConfirmed( false ) ;
MAp = Average( Close, p ) ;
MAk = Average( Close, k ) ;
kLess1 = k - 1 ;
MAkLess1 = Average( Close, kLess1 ) ;
pLess1 = p - 1 ;
MApLess1 = Average( Close, pLess1 ) ;
if k <> p then
    TC = ( p * kLess1 * MAkLess1 - k * pLess1 *
     MApLess1 ) / ( k - p ) ;
DescCrossPrediction = TC crosses under Close ;
AscCrossPrediction = TC crosses over Close ;
ExpectMACross = DescCrossPrediction or AscCrossPrediction ;
Confirmed = MAk crosses over MAp or MAk crosses under MAp ;
ROC = RateOfChange( Close, 1 ) ;
HalfUpperRange = Highest( ROC, 800 ) ;
HalfLowerRange = Lowest( ROC, 800 ) ;
Ucoeff = 1 + 0.02 * HalfUpperRange ;
Lcoeff = 1 + 0.02 * HalfLowerRange ;
BarsSinceCross = MRO( Confirmed, 10, 1 ) ;
Unlikely = TC < Lcoeff * Close or TC > Ucoeff * Close ;
NotUnlikely = IffLogic( Unlikely, false, true ) ;
NotExpectMACross = IffLogic( ExpectMACross, false, true ) ;
NotConfirmed = IffLogic( Confirmed, false, true ) ;
if Unlikely then
    begin
    Plot1( Open, "Open", UnlikelyColor ) ;
    Plot2( High, "High", UnlikelyColor ) ;
    Plot3( Low, "Low", UnlikelyColor ) ;
    Plot4( Close , "Close", UnlikelyColor ) ;
    end ;
if NotUnlikely
    and NotExpectMACross
    and NotConfirmed
    and BarsSinceCross > 3
    and TC < Close
then
    begin
    Plot1( Open, "Open", ExpectBearCross, Default, 1 ) ;
    Plot2( High, "High", ExpectBearCross, Default, 1 ) ;
    Plot3( Low, "Low", ExpectBearCross, Default, 1 ) ;
    Plot4( Close, "Close", ExpectBearCross, Default, 1 ) ;
    Plot5( Open, "Open", BearCross, Default, 4 ) ;
    Plot6( High, "High", BearCross, Default, 4 ) ;
    Plot7( Low, "Low", BearCross, Default, 4 ) ;
    Plot8( Close, "Close", BearCross, Default, 4 ) ;
    end
else if NotUnlikely
    and NotExpectMACross
    and NotConfirmed
    and BarsSinceCross > 3
    and TC > Close
then
    begin
    Plot1( Open, "Open", ExpectBullCross, Default, 1 ) ;
    Plot2( High, "High", ExpectBullCross, Default, 1 ) ;
    Plot3( Low, "Low", ExpectBullCross, Default, 1 ) ;
    Plot4( Close, "Close", ExpectBullCross, Default, 1 ) ;
    Plot5( Open, "Open", BullCross, Default, 4 ) ;
    Plot6( High, "High", BullCross, Default, 4 ) ;
    Plot7( Low, "Low", BullCross, Default, 4 ) ;
    Plot8( Close, "Close", BullCross, Default, 4 ) ;
    end
else if AscCrossPrediction then
    begin
    Plot1( Open, "Open", BearCrossNext, Default, 5 ) ;
    Plot2( High, "High", BearCrossNext, Default, 5 ) ;
    Plot3( Low, "Low", BearCrossNext, Default, 5 ) ;
    Plot4( Close, "Close", BearCrossNext, Default, 5 ) ;
    end
else if DescCrossPrediction then
    begin
    Plot1( Open, "Open", BullCrossNext, Default, 5 ) ;
    Plot2( High, "High", BullCrossNext, Default, 5 ) ;
    Plot3( Low, "Low", BullCrossNext, Default, 5 ) ;
    Plot4( Close, "Close", BullCrossNext, Default, 5 ) ;
    end ;
if MAp crosses over MAk then
    Plot10( Close, "BullCross", BullCross, Default, 6 )
else if MAp crosses under MAk then
    Plot11( Close, "BearCross", BearCross, Default, 6 ) ;
Plot12( MAp, "MAp" ) ;
Plot13( MAk, "MAk" ) ;


--Mark Mills
TradeStation Securities, Inc.
www.TradeStation.com
GO BACK



eSIGNAL: MOVING AVERAGE CROSSOVERS (PART II)

For this month's Traders' Tip based on Dimitris Tsokakis' article, "Moving Average Crossovers (Part II)," we've provided the formulas "Sma_StochCross.efs" and "Probable_SmaCross.efs."
 

SMA STOCHASTICS CROSS
/****************************************************
Provided By : eSignal (c) Copyright 2006
Description:  Moving Average Crossovers Part II
              by Dimitris Tsokakis
Version 1.0  1/08/2007
Notes:
* March 2007 Issue of Stocks and Commodities Magazine
* Study requires version 8.0 or later.
Formula Parameters:                     Default:
Fast MA Periods                         20
Slow MA Periods                         30
%K Length                               14
%K Smoothing                            1
%D Length                               3
****************************************************/
function preMain() {
    setStudyTitle("SMA of Stoch Cross Predictor ");
    setShowTitleParameters(false);
    setCursorLabelName("StochD", 0);
    setCursorLabelName("Fast MA", 1);
    setCursorLabelName("Slow MA", 2);
    setCursorLabelName("TC", 3);
 
    setDefaultBarFgColor(Color.khaki, 0);
    setDefaultBarFgColor(Color.black, 1);
    setDefaultBarFgColor(Color.red, 2);
    setDefaultBarFgColor(Color.magenta, 3);
 
    setDefaultBarThickness(2, 0);
    setDefaultBarThickness(1, 1);
    setDefaultBarThickness(1, 2);
    setDefaultBarThickness(2, 3);
 
    setDefaultFont("Arial", 11);
    setStudyMax(115);
    setStudyMin(-15);
    var fp1 = new FunctionParameter("MAlen1", FunctionParameter.NUMBER);
        fp1.setName("Fast MA Periods");
        fp1.setLowerLimit(2);
        fp1.setDefault(20);
    var fp2 = new FunctionParameter("MAlen2", FunctionParameter.NUMBER);
        fp2.setName("Slow MA Periods");
        fp2.setLowerLimit(2);
        fp2.setDefault(30);
    var fp3 = new FunctionParameter("nK", FunctionParameter.NUMBER);
        fp3.setName("%K Length");
        fp3.setLowerLimit(1);
        fp3.setDefault(14);
    var fp4 = new FunctionParameter("nKSmooth", FunctionParameter.NUMBER);
        fp4.setName("%K Smoothing");
        fp4.setLowerLimit(1);
        fp4.setDefault(1);
    var fp5 = new FunctionParameter("nD", FunctionParameter.NUMBER);
        fp5.setName("%D Length");
        fp5.setLowerLimit(1);
        fp5.setDefault(3);
}
// Global Variables
var bVersion  = null;    // Version flag
var bInit     = false;   // Initialization flag
var xStochD = null;
var xMA1 = null;        // fast MA
var xMA2 = null;        // slow MA
var xTC  = null;        // Tomorrow's close
function main(MAlen1, MAlen2, nK, nKSmooth, nD) {
    if (bVersion == null) bVersion = verify();
    if (bVersion == false) return;
    //Initialization
    if (bInit == false) {
        xStochD = stochD(nK, nKSmooth, nD);
        xMA1 = sma(MAlen1, xStochD);  // fast MA
        xMA2 = sma(MAlen2, xStochD);  // slow MA
        xTC = efsInternal("calcTC", MAlen1, MAlen2, xStochD);
        bInit = true;
    }
    var nC1    = xStochD.getValue(0);
    var nC1_1  = xStochD.getValue(-1);
    var nTagID = rawtime(0);
    var nMA1_0 = xMA1.getValue(0);
    var nMA1_1 = xMA1.getValue(-1);
    var nMA2_0 = xMA2.getValue(0);
    var nMA2_1 = xMA2.getValue(-1);
    var nTC_0 = xTC.getValue(0);
    var nTC_1 = xTC.getValue(-1);
    if (nMA1_1 == null || nMA2_1 == null || nTC_1 == null) return;
 
    // MA-crossover
    if (nMA1_0 > nMA2_0 && nMA1_1 <= nMA2_1) {
        // cross up
        drawText("MA", TopRow1, Color.green, Text.BOLD|Text.FRAME|Text.CENTER, "MA"+nTagID);
        drawShapeRelative(0, nC1, Shape.UPARROW, null, Color.green,
            Shape.TOP, nTagID);
    } else if (nMA1_0 < nMA2_0 && nMA1_1 >= nMA2_1) {
        // cross down
        drawText("MA", BottomRow1, Color.red, Text.BOLD|Text.FRAME|Text.CENTER, "MA"+nTagID);
        drawShapeRelative(0, nC1, Shape.DOWNARROW, null, Color.red,
            Shape.BOTTOM, nTagID);
    } else {
        removeShape(nTagID);
        removeText("MA"+nTagID);
    }
 
    // TC cross
    if (nTC_0 > nC1 && nTC_1 <= nC1_1) {
        drawShapeRelative(0, Math.min(nTC_0, 110), Shape.CIRCLE, null, Color.red, null, "TC"+nTagID);
    } else if (nTC_0 < nC1 && nTC_1 >= nC1_1) {
        drawShapeRelative(0, Math.max(nTC_0, -10), Shape.CIRCLE, null, Color.green, null, "TC"+nTagID);
    } else {
        removeShape("TC"+nTagID);
    }
 
    return new Array(nC1, nMA1_0, nMA2_0, xTC.getValue(0));
}
// TC Globals
var bInitTC = false;
var xTCMA1 = null;
var xTCMA2 = null;
function calcTC(Pfast, Kslow, xStD) {
    // k > p
    //TC = Pfast*(Kslow-1) * MA(Kslow-1) - Kslow*(Pfast-1) * MA(Pfast-1)  /  Kslow-Pfast;
 
    if (bInitTC == false) {
        xTCMA1 = sma((Pfast-1), xStD);
        xTCMA2 = sma((Kslow-1), xStD)
        bInitTC = true;
    }
 
    var nTC = null;
    var nMAfast = xTCMA1.getValue(0);
    var nMAslow = xTCMA2.getValue(0);
    if (nMAslow == null || nMAfast == null) return;
 
    if (Kslow-Pfast == 0) {
        nTC = ( (Pfast*(Kslow-1) * nMAslow) - (Kslow*(Pfast-1) * nMAfast) ) /  1;
    } else {
        nTC = ( (Pfast*(Kslow-1) * nMAslow) - (Kslow*(Pfast-1) * nMAfast) ) /  (Kslow-Pfast);
    }
 
    return nTC;
}
function verify() {
    var b = false;
    if (getBuildNumber() < 779) {
        drawTextAbsolute(5, 35, "This study requires version 8.0 or later.",
            Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
            null, 13, "error");
        drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=https://www.esignal.com/download/default.asp",
            Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
            null, 13, "upgrade");
        return b;
    } else {
        b = true;
    }
 
    return b;
}
There are several formula parameters that may be configured through the Edit Studies option in the Advanced Chart to change the periods used for the two moving averages and the stochastic study used by Sma_StochCross.efs.
 
PROBABLY SMA CROSS
/**************************************************
Provided By : eSignal (c) Copyright 2006
Description:  Moving Average Crossovers Part II
              by Dimitris Tsokakis
Version 1.0  1/08/2007
Notes:
* March 2007 Issue of Stocks and Commodities Magazine
* Study requires version 8.0 or later.
Formula Parameters:                     Default:
Fast MA Periods                         20
Slow MA Periods                         30
******************************************************/
function preMain() {
    setPriceStudy(true);
    setStudyTitle("Probable SMA Cross ");
    setShowTitleParameters(false);
    setCursorLabelName("Fast MA", 0);
    setCursorLabelName("Slow MA", 1);
    setCursorLabelName("TC", 2);
 
    setDefaultBarFgColor(Color.blue, 0);
    setDefaultBarFgColor(Color.red, 1);
    setDefaultBarFgColor(Color.magenta, 2);
 
    setDefaultBarThickness(1, 0);
    setDefaultBarThickness(1, 1);
    setDefaultBarThickness(2, 2);
 
    setColorPriceBars(true);
    setDefaultPriceBarColor(Color.khaki);
    setDefaultFont("Arial", 11);
    var fp1 = new FunctionParameter("MAlen1", FunctionParameter.NUMBER);
        fp1.setName("Fast MA Periods");
        fp1.setLowerLimit(2);
        fp1.setDefault(20);
    var fp2 = new FunctionParameter("MAlen2", FunctionParameter.NUMBER);
        fp2.setName("Slow MA Periods");
        fp2.setLowerLimit(2);
        fp2.setDefault(30);
}
// Global Variables
var bVersion    = null;    // Version flag
var bInit       = false;   // Initialization flag
var nBars       = 0;
var aPrint      = new Array(6);
for (var i = 0; i < 6; i++) {
    aPrint[i] = true;
}
var xMA1 = null;        // fast MA
var xMA2 = null;        // slow MA
var xTC  = null;        // Tomorrow's close
function main(MAlen1, MAlen2) {
    if (bVersion == null) bVersion = verify();
    if (bVersion == false) return;
    //Initialization
    if (bInit == false) {
        xMA1 = sma(MAlen1);  // fast MA
        xMA2 = sma(MAlen2);  // slow MA
        xTC = efsInternal("calcTC", MAlen1, MAlen2);
        bInit = true;
    }
    var nState      = getBarState();
    var bDscP       = false;
    var bAscP       = false;
    var bExpectMA   = false;
    var bConfirmed  = false;
    var bCrossUp    = false;
    var bCrossDn    = false;
    var bFilter     = false;
    var nUR         = null;
    var nLR         = null;
    var nUcoeff     = null;
    var nLcoeff     = null;
    var bExpect     = false;
 
    var nC          = close(0);
    var nTagID      = rawtime(0);
    var nMA1_0      = xMA1.getValue(0);
    var nMA1_1      = xMA1.getValue(-1);
    var nMA2_0      = xMA2.getValue(0);
    var nMA2_1      = xMA2.getValue(-1);
    var nTC_0       = xTC.getValue(0);
    var nTC_1       = xTC.getValue(-1);
    if (nMA1_1 == null || nMA2_1 == null || nTC_1 == null) return;
 
    if (nState == BARSTATE_NEWBAR) nBars++;
 
    // MA-crossover
    if (nMA1_0 > nMA2_0 && nMA1_1 <= nMA2_1) {
        // cross up
        bConfirmed = true;
        bCrossUp = true;
        nBars = 1;
        drawText("MA", AboveBar2, Color.green, Text.BOLD|Text.FRAME|Text.CENTER, "MA"+nTagID);
        drawShape(Shape.UPARROW, AboveBar1, Color.green, nTagID);
    } else if (nMA1_0 < nMA2_0 && nMA1_1 >= nMA2_1) {
        // cross down
        bConfirmed = true;
        bCrossDn = true;
        nBars = 1;
        drawText("MA", BelowBar2, Color.red, Text.BOLD|Text.FRAME|Text.CENTER, "MA"+nTagID);
        drawShape(Shape.DOWNARROW, BelowBar1, Color.red, nTagID);
    } else {
        removeShape(nTagID);
        removeText("MA"+nTagID);
    }
 
    // TC cross
    if (nTC_0 > nC && nTC_1 < close(-1)) {
        // cross up
        bAscP = true;
        setPriceBarColor(Color.black);
    } else if (nTC_0 < nC && nTC_1 > close(-1)) {
        // cross down
        bDscP = true;
        setPriceBarColor(Color.black);
    } else {
        removeShape("TC"+nTagID);
    }
 
    if (bAscP || bDscP) bExpectMA = true;
    nUR         = 2 * upperDonchian(800, roc(1), 0);
    nLR         = 2 * lowerDonchian(800, roc(1), 0);
    if (nUR == null || nLR == null) return;
 
    nUcoeff      = 1 + nUR/100;
    nLcoeff      = 1 + nLR/100;
 
    bFilter = (nTC_0 < (nLcoeff * nC)) || (nTC_0 > (nUcoeff * nC));
    bExpect = !bFilter;
 
    if (getCurrentBarIndex() >= -1 && nState == BARSTATE_NEWBAR) {
        for (var i = 0; i < 6; i++) {
            aPrint[i] = false;
        }
    }
 
    if (bExpect && !bExpectMA && !bConfirmed && nBars > 3 && nTC_0 < nC) {
        if (aPrint[0] == false) {
            debugPrintln("Expect a bearish MAcross soon.");
            aPrint[0] = true;
        }
        setPriceBarColor(Color.black);
    }
    if (bExpect && !bExpectMA && !bConfirmed && nBars > 3 && nTC_0 > nC) {
        if (aPrint[1] == false) {
            debugPrintln("Expect a bullish MAcross soon.");
            aPrint[1] = true;
        }
        setPriceBarColor(Color.black);
    }
    if (bDscP) {
        if (aPrint[2] == false) {
            debugPrintln("EXPECT a bearish MAcross on next bar.");
            aPrint[2] = true;
        }
    }
    if (bAscP) {
        if (aPrint[3] == false) {
            debugPrintln("EXPECT a bullish MAcross on next bar.");
            aPrint[3] = true;
        }
    }
    if (bCrossUp) {
        if (aPrint[4] == false) {
            debugPrintln("Bullish MAcross.");
            aPrint[4] = true;
        }
    }
    if (bCrossDn) {
        if (aPrint[5] == false) {
            debugPrintln("Bearish MAcross.");
            aPrint[5] = true;
        }
    }
 
    return new Array(nMA1_0, nMA2_0, nTC_0.toFixed(4));
}
// TC Globals
var bInitTC = false;
var xTCMA1 = null;
var xTCMA2 = null;
function calcTC(Pfast, Kslow) {
    // k > p
    //TC = Pfast*(Kslow-1) * MA(Kslow-1) - Kslow*(Pfast-1) * MA(Pfast-1)  /  Kslow-Pfast;
 
    if (bInitTC == false) {
        xTCMA1 = sma((Pfast-1));
        xTCMA2 = sma((Kslow-1))
        bInitTC = true;
    }
 
    var nTC = null;
    var nMAfast = xTCMA1.getValue(0);
    var nMAslow = xTCMA2.getValue(0);
    if (nMAslow == null || nMAfast == null) return;
 
    if (Kslow-Pfast == 0) {
        nTC = ( (Pfast*(Kslow-1) * nMAslow) - (Kslow*(Pfast-1) * nMAfast) ) /  1;
    } else {
        nTC = ( (Pfast*(Kslow-1) * nMAslow) - (Kslow*(Pfast-1) * nMAfast) ) /  (Kslow-Pfast);
    }
 
    return nTC;
}
function verify() {
    var b = false;
    if (getBuildNumber() < 779) {
        drawTextAbsolute(5, 35, "This study requires version 8.0 or later.",
            Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
            null, 13, "error");
        drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=https://www.esignal.com/download/default.asp",
            Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
            null, 13, "upgrade");
        return b;
    } else {
        b = true;
    }
 
    return b;
}


In real time, the Probable_SmaCross.efs will print the messages as outlined in the sidebar of the article to the formula output window (Figure 2). The Sma_StochCross.efs will draw a green/red circle on the chart to indicate the cross of the TC and green/red arrows for the MA crosses (Figure 3).
 

FIGURE 2: eSIGNAL, PROBABLE SMA CROSSINGS. The Probable_SMACross.efs script will print messages to the formula output window in real time, as described in Tsokakis' article.


FIGURE 3: eSIGNAL, SMA STOCHASTICS CROSSINGS. The SMA_StochCross.efs eSignal script will draw a green/red circle on the chart to indicate the cross of the TC (tomorrow's close indicator) and green/red arrows for the moving average crosses.

To discuss this study or download a complete copy of the formula, please visit the EFS Library Discussion Board forum under the Bulletin Boards link at www.esignalcentral.com. The eSignal formula scripts (EFS) are also available for copying and pasting from the STOCKS & COMMODITIES website at Traders.com.

--Jason Keck
eSignal, a division of Interactive Data Corp.
800 815-8256, www.esignalcentral.com
GO BACK



METASTOCK: MOVING AVERAGE CROSSOVERS (PART II)

Dimitris Tsokakis' article in this issue, "Moving Average Crossovers (Part II)," introduces more formulas to analyze moving averages. The formula for the indicator and the instructions on adding it to MetaStock follow:

To enter these indicators into MetaStock:

1. In the Tools menu, select Indicator Builder.
2. Click New to open the Indicator Editor for a new indicator.
3. Type the name of the formula.
4. Click in the larger window and type in the formula.
5. Click OK to close the Indicator Editor.
Name: the Stochastic TC graph
Formula:
p1:=Mov(Stoch(5,3),3,S);
y:=Input("short MA time periods", 2, 200, 20);
z:=Input("long MA time periods", 3, 200, 30);
may:=Mov(p1,y,S);
maz:=Mov(p1,z,S);
test:=If(z-y=0,-9999,z-y);
tc:=If(test=-9999, 0,
(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/test);
tc;
Stoch(5,3);
p1


This indicator will prompt for the time periods of the two moving averages, but it defaults to the values suggested in Tsokakis' article.

The explorations and instructions for creating them in MetaStock are:

6. Select the Column B tab and enter the following formula:
p1:=Mov(Stoch(5,3),3,S);
y:=20;
z:=30;
may:=Mov(p1,y,S);
maz:=Mov(p1,z,S);
tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);
ascxpred:=Cross(p1,tc);
confascx:=Cross(may,maz);
asctotpred:=Cum(ascxpred);
acc0ascxpred:=Cum(confascx AND Ref(ascxpred,-1));
100*(acc0ascxpred/asctotpred)
7. Click in the Col Name box and enter the text: "1 day".
8. Select the Column C tab and enter the following formula.
p1:=Mov(Stoch(5,3),3,S);
y:=20;
z:=30;
may:=Mov(p1,y,S);
maz:=Mov(p1,z,S);
tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);
ascxpred:=Cross(p1,tc);
confascx:=Cross(may,maz);
asctotpred:=Cum(ascxpred);
acc1ascxpred:=Cum(confascx AND Ref(ascxpred,-2));
100*(acc1ascxpred/asctotpred)
9. Click in the Col Name box and enter the text: "2 day".
10. Select the Column D tab and enter the following formula.
p1:=Mov(Stoch(5,3),3,S);
y:=20;
z:=30;
may:=Mov(p1,y,S);
maz:=Mov(p1,z,S);
tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);
ascxpred:=Cross(p1,tc);
confascx:=Cross(may,maz);
asctotpred:=Cum(ascxpred);
acc2ascxpred:=Cum(confascx AND Ref(ascxpred,-3));
100*(acc2ascxpred/asctotpred)
11. Click in the Col Name box and enter the text: "3 day".
12. Select the Column E tab and enter the following formula.
p1:=Mov(Stoch(5,3),3,S);
y:=20;
z:=30;
may:=Mov(p1,y,S);
maz:=Mov(p1,z,S);
tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);
ascxpred:=Cross(p1,tc);confascx:=Cross(may,maz);
asctotpred:=Cum(ascxpred);
uslsascxpre:=Cum(confascx AND ascxpred);
100*(uslsascxpre/asctotpred)
13. Click in the Col Name box and enter the text: "useless".
14. Select the Column F tab and enter the following formula.
p1:=Mov(Stoch(5,3),3,S);
y:=20;
z:=30;
may:=Mov(p1,y,S);
maz:=Mov(p1,z,S);
tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);
ascxpred:=Cross(p1,tc);ascxpred:=Cross(C,tc);
confascx:=Cross(may,maz);
asctotpred:=Cum(ascxpred);
acc0ascxpred:=Cum(confascx AND Ref(ascxpred,-1));
acc1ascxpred:=Cum(confascx AND Ref(ascxpred,-2));
acc2ascxpred:=Cum(confascx AND Ref(ascxpred,-3));
uslsascxpre:=Cum(confascx AND ascxpred);
100-(100*(acc0ascxpred+acc1ascxpred+acc2ascxpred+uslsascxpre)/asctotpred)
15. Click in the Col Name box and enter the text: "false"
16. Click OK to close the exploration editor.
I also suggest, before closing the editor, adding the following text to the Notes field
to provide a more detailed description of the column names:
columns descriptions:
1: total ascending predictions
2: percent confirmed 1 day later
3: percent confirmed 2 days later
4: percent confirmed 3 days later
5: percent useless (confirmed same day as prediction)
6: percent of false predictions
The second exploration is added in the same manner, but the formulas and notes are different.
The column names are the same. The steps to create it are:
1. Select Tools > the Explorer.
2. Click New
3. Enter a name, "SMA cross stats - descending"
4. Select the Column A tab and enter the following formula.
p1:=Mov(Stoch(5,3),3,S);
y:=20;
z:=30;
may:=Mov(p1,y,S);
maz:=Mov(p1,z,S);
tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);
decxpred:=Cross(tc,p1);
confdecx:=Cross(maz,may);
Cum(decxpred);
5. Click in the Col Name box and enter the text: "Total".
6. Select the Column B tab and enter the following formula.
p1:=Mov(Stoch(5,3),3,S);
y:=20;
z:=30;
may:=Mov(p1,y,S);
maz:=Mov(p1,z,S);
tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);
decxpred:=Cross(tc,p1);
confdecx:=Cross(maz,may);
destotpred:=Cum(decxpred);
acc0desxpred:=Cum(confdecx AND Ref(decxpred,-1));
100*(acc0desxpred/destotpred)
7. Click in the Col Name box and enter the text: "1 day".
8. Select the Column C tab and enter the following formula.
p1:=Mov(Stoch(5,3),3,S);
y:=20;
z:=30;
may:=Mov(p1,y,S);
maz:=Mov(p1,z,S);
tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);
decxpred:=Cross(tc,p1);
confdecx:=Cross(maz,may);
destotpred:=Cum(decxpred);
acc1desxpred:=Cum(confdecx AND Ref(decxpred,-2));
100*(acc1desxpred/destotpred)
9. Click in the Col Name box and enter the text: "2 day".
10. Select the Column D tab and enter the following formula.
p1:=Mov(Stoch(5,3),3,S);
y:=20;
z:=30;
may:=Mov(p1,y,S);
maz:=Mov(p1,z,S);
tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);
decxpred:=Cross(tc,p1);
confdecx:=Cross(maz,may);
destotpred:=Cum(decxpred);
acc2desxpred:=Cum(confdecx AND Ref(decxpred,-3));
100*(acc2desxpred/destotpred)
11. Click in the Col Name box and enter the text: "3 day".
12. Select the Column E tab and enter the following formula.
p1:=Mov(Stoch(5,3),3,S);
y:=20;
z:=30;
may:=Mov(p1,y,S);
maz:=Mov(p1,z,S);
tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);
decxpred:=Cross(tc,p1);
confdecx:=Cross(maz,may);
destotpred:=Cum(decxpred);
uslsdesxpred:=Cum(confdecx AND decxpred);
100*(uslsdesxpred/destotpred)
13. Click in the Col Name box and enter the text: "useless".
14. Select the Column F tab and enter the following formula.
p1:=Mov(Stoch(5,3),3,S);
y:=20;
z:=30;
may:=Mov(p1,y,S);
maz:=Mov(p1,z,S);
tc:=(y*(z-1)*Mov(p1,z-1,S)-z*(y-1)*Mov(p1,y-1,S))/(z-y);
decxpred:=Cross(tc,p1);
confdecx:=Cross(maz,may);
destotpred:=Cum(decxpred);
acc0desxpred:=Cum(confdecx AND Ref(decxpred,-1));
acc1desxpred:=Cum(confdecx AND Ref(decxpred,-2));
acc2desxpred:=Cum(confdecx AND Ref(decxpred,-3));
uslsdesxpre:=Cum(confdecx AND decxpred);
100-(100*(acc0desxpred+acc1desxpred+acc2desxpred+uslsdesxpre)/destotpred)
15. Click in the Col Name box and enter the text: "false"
16. Click OK to close the exploration editor.
It should also be noted that MetaStock version 10 users can put all 12 columns -- both explorations -- into a single exploration. It would only require changing the column names a bit in order to easily tell which ones are for the ascending crosses and which ones are for the descending crosses. The second exploration would then have its formulas put in columns G through L.

--William Golson
MetaStock Support Representative
Equis International (A Reuters Company)
801 265-9998, www.metastock.com
GO BACK



WEALTH-LAB: MOVING AVERAGE CROSSOVERS (PART II)

Here we present a WealthScript interpretation of the code given in the sidebar named "Probable SMA Cross Days" to Dimitris Tsokakis' article, "Moving Average Crossovers (Part II)," in this issue.

Instead of generating text on the chart, as discussed in the article, we chose to color the upper pane's background light green/red when a probable SMA crossover/under will occur "soon." Likewise, when a crossover is predicted by virtue of TC (tomorrow's close) crossing of the close series, the pane's background is colored light blue (Figure 4).
 


FIGURE 4: WEALTH-LAB, PROBABLE MOVING AVERAGE CROSSOVERS. Probable crossovers return many more "false positives" (two can be seen in this chart) than the predicted crossovers. Nevertheless, they may aid in preparing for such crossovers in real-time trading.

WealthScript code:
{$I 'CrossOverBar'}
{$I 'RevEngSMA_TC'}
const LOOKBACK = 800;
var Bar, bars, UR, LR, Uc, Lc, TC, P, K, hTC, hMAp, hMAk, Pane1: integer;
var expect, expectMACross, confirmed, Xover, Xunder, predXover, predXunder: boolean;
HideVolume;
P := 20; K := 30;
hMAp := SMASeries( #Close, P );
hMAk := SMASeries( #Close, K );
hTC := RevEngSMA_TCSeries( #Close, P, K );
UR := MultiplySeriesValue(
        HighestSeries( ROCSeries( #Close, 1 ), LOOKBACK ), 2 );
Uc := MultiplySeries(
        AddSeriesValue( DivideSeriesValue( UR, 100 ), 1 ), #Close );
LR := MultiplySeriesValue(
        LowestSeries( ROCSeries( #Close, 1 ), LOOKBACK ), 2 );
Lc := MultiplySeries(
        AddSeriesValue( DivideSeriesValue( LR, 100 ), 1 ), #Close );
{ Plotting }
Pane1 := CreatePane( 75, true, true );
PlotSeries( hMAp, 0, #Green, #Thin );
PlotSeries( hMAk, 0, #Red, #Thin );
PlotSeriesLabel( hTC, Pane1, #Red, #Thick, 'Tomorrow''s Close (Anticipated)' );
PlotSeriesLabel( #Close, Pane1, #Black, #Thin, 'Today''s Close' );
PlotSeries( Uc, Pane1, #Gray, #Thin );
PlotSeries( Lc, Pane1, #Gray, #Thin );
{ Strategy and coloring }
for Bar := LOOKBACK to BarCount - 1 do
begin
  bars := Round( Min( CrossOverBar( Bar, hMAp, hMAk ), CrossOverBar( Bar, hMAk, hMAp ) ) );
  bars := Bar - bars;
  predXover := CrossUnder( Bar, hTC, #Close );
  predXunder := CrossOver( Bar, hTC, #Close );
  Xover := CrossOver( Bar, hMAp, hMAk );
  Xunder := CrossUnder( Bar, hMAp, hMAk );
  confirmed := Xover or Xunder;
  expect := ( @hTC[Bar] > @Lc[Bar] ) and ( @hTC[Bar] < @Uc[Bar] );
  expectMACross := predXover or predXunder;
  if expect then
    if not expectMACross and not confirmed and ( bars > 3 ) then
      if @hTC[Bar] < PriceClose( Bar ) then  // 'Expect bearish cross SOON'
        SetPaneBackgroundColor( Bar, Pane1, #RedBkg )
      else  // 'Expect bullish MAcross SOON'
        SetPaneBackgroundColor( Bar, Pane1, #GreenBkg );
  if Xover then  // 'Bullish MAcross'
    SetBackgroundColor( Bar, #GreenBkg )
  else if Xunder then // 'Bearish MAcross'
    SetBackgroundColor( Bar, #RedBkg )
  else if expectMACross then  // 'EXPECT a bullish/bearish cross TOMORROW'
    SetPaneBackgroundColor( Bar, Pane1, #BlueBkg );
end;


-- Robert Sucher
www.wealth-lab.com
GO BACK



NEUROSHELL TRADER: MOVING AVERAGE CROSSOVERS (PART II)

The indicators discussed in "Moving Average Crossovers (Part II)" by Dimitris Tsokakis in this issue can be easily implemented in NeuroShell Trader by combining a few of the NeuroShell Trader's 800+ indicators in a trading strategy. To implement the indicator, select "New Indicator ..." from the Insert menu and use the Indicator Wizard to create the following indicators:
 

Tomorrow's Close Crossover:
TC:    Divide(Subtract(Mult3(P, K-1, MovAvg(Close,K-1)),
              Mult3(K, P-1, MovAvg(Close,K-1))),
              Subtract(K, P))
Composite Tickers:
MAp:    MovAvg (Close, P)
MAk:    MovAvg (Close, K)
~DcrPR:    ChartPageSum ( CrossAbove ( TC, Close ) )
~AcrPR:    ChartPageSum ( CrossAbove ( Close, TC ) )
~Dcr:    ChartPageSum ( CrossAbove (MAk, MAp ) )
~Acr:    ChartPageSum ( CrossAbove (MAp, MAk ) )
~Count:    ChartPageCount ( ANotEqualB ( Close, 0 ) )
Population of Cross Predictions VS. Actual Crosses:
DcrPR:    Multiply2 ( 100, Divide( ~DcrPR, ~Count ) )
AcrPR:    Multiply2 ( 100, Divide( ~AcrPR, ~Count ) )
Dcr:    Multiply2 ( 100, Divide( ~Dcr, ~Count ) )
Acr:    Multiply2 ( 100, Divide( ~Acr, ~Count ) )
Probable SMA Cross Days:
ExpectMACross:  OR2 (CrossAbove ( TC, Close ), CrossAbove ( Close, TC ) )
Confirmed:    OR2 (CrossAbove (MAk, MAp ), CrossAbove (MAp, MAk ) )
UR:    Multiply2 ( 2, Maximum( RateOfChange ( Close, 1 ), 800 ) )
LR:    Multiply2 ( 2, Minimum( RateOfChange ( Close, 1 ), 800 ) )
Ucoeff:    Add2 ( 1, Divide ( UR, 100 ) )
Lcoeff:    Add2 ( 1, Divide ( LR, 100 ) )
Filter:    OR2 ( A<B ( TC, Multiply2 ( Lcoeff, Close ), A>B ( TC, Multiply2 ( Ucoeff, Close ) )
Bars:    BarsSinceCond-AdvIndSet2 ( OR2 (CrossAbove (MAp, MAk ), CrossAbove (MAk, MAp ) )
Expect:    Not ( Filter )
BearishMAcrossSoon:    AND4 ( Expect, Not(ExpectMACross), Not(Confirmed), A>B(Bars, 3), A<B(TC,Close) )
BullishMAcrossSoon:    AND4 ( Expect, Not(ExpectMACross), Not(Confirmed), A>B(Bars, 3), A>B(TC,Close) )
Predicting SMA Crossovers with Stochastics:
C1:    Stochastic%D(High, Low, Close, 5, 5)
MAp1:    MovAvg (C1, P)
MAk1:    MovAvg (C1, K)
TC1:    Divide(Subtract(Mult3(P, K-1, MovAvg(C1,K-1)), Mult3(K, P-1, MovAvg(C1,K-1))), Subtract(K, P))
Stochastic SMA Crossover Prediction Statistics:
DescCrossPrediction:    CrossAbove (TC1, C1)
AscCrossPrediction:    CrossAbove (C1, TC1)
ConfirmedDesc:    CrossAbove (MAk1, MAp1)
ConfirmedAsc:    CrossAbove (MAp1, MAk1)
DescTotalPredictions:    CumSum ( DescCrossPrediction, 0 )
Accurate0DescPredictions:    CumSum ( And2 ( ComfirmedDesc, A=B( Lag(DescCrossPrediction,1), 1 ) ), 0 )
Accurate1DescPredictions:    CumSum ( And2 ( ComfirmedDesc, A=B( Lag(DescCrossPrediction,1), 2 ) ), 0 )
Accurate2DescPredictions:    CumSum ( And2 ( ComfirmedDesc, A=B( Lag(DescCrossPrediction,1), 3 ) ), 0 )
UselessDescPredictions:    CumSum ( And2 ( ComfirmedDesc, DescCrossPrediction ), 0 )
AscTotalPredictions:    CumSum (AscCrossPrediction, 0 )
Accurate0AscPredictions:    CumSum ( And2 ( ComfirmedAsc, A=B( Lag(AscCrossPrediction,1), 1 ) ), 0 )
Accurate1AscPredictions:    CumSum ( And2 ( ComfirmedAsc, A=B( Lag(AscCrossPrediction,1), 2 ) ), 0 )
Accurate2AscPredictions:    CumSum ( And2 ( ComfirmedAsc, A=B( Lag(AscCrossPrediction,1), 3 ) ), 0 )
UselessAscPredictions:    CumSum ( And2 ( ComfirmedAsc, AscCrossPrediction ), 0 )
Acc0 Desc%:    Multiply2 ( 100, Divide ( Accurate0DescPredictions, DescTotalPredictions ) )
Acc1 Desc%:    Multiply2 ( 100, Divide ( Accurate1DescPredictions, DescTotalPredictions ) )
Acc2 Desc%:    Multiply2 ( 100, Divide ( Accurate2DescPredictions, DescTotalPredictions ) )
Useless Desc%:    Multiply2 ( 100, Divide ( UselessDescPredictions, DescTotalPredictions ) )
Acc0 Asc%:    Multiply2 ( 100, Divide ( Accurate0AscPredictions, AscTotalPredictions ) )
Acc1 Asc %:    Multiply2 ( 100, Divide ( Accurate1AscPredictions, AscTotalPredictions ) )
Acc2 Asc %: Multiply2 ( 100, Divide ( Accurate2AscPredictions, AscTotalPredictions ) )
Useless Asc%:     Multiply2 ( 100, Divide ( UselessAscPredictions, AscTotalPredictions ) )


A sample chart implementing these concepts is shown in Figure 5. For more information on NeuroShell Trader, visit www.NeuroShell.com.

FIGURE 5: NEUROSHELL, PROBABLE CROSSOVERS. Here is a sample NeuroShell chart demonstrating the concepts given in the sidebars "Population of Cross Predictions vs. Actual Crosses" and "SMA Crossovers with Stochastics" found in Dimitris Tsokakis' article in this issue, "Moving Average Crossovers (Part II)."


--Marge Sherald, Ward Systems Group, Inc.
301 662-7950, sales@wardsystems.com
www.neuroshell.com
GO BACK



SNAPSHEETS: MOVING AVERAGE CROSSOVERS (PART II)

For the article by Dimitris Tsokakis in this issue, "Moving Average Crossovers (Part II)," we've created a SnapSheet, which we have now made available in the SnapSheets web library. To load the SnapSheet, open the SnapSheets program, then click the "Open SnapSheet" button. Click "web library," then double-click on the Traders' Tips folder, then click "Anticipating Moving Average Crossovers (Part II)."

No code or cutting and pasting is required to use this SnapSheet. You may view and edit the logic behind each onscreen element by opening its Block Diagram. You can change the periods of the short and long moving averages by single-clicking the Short Avg and Long Avg values in the left toolbar of the price pane.

Here is an explanation of how this SnapSheet will display Tsokakis' concept on the chart (see Figure 6):

FIGURE 6: SNAPSHEETS, PROBABLE CROSSOVERS. Here is a sample chart demonstrating the concepts given in Dimitris Tsokakis' article in this issue, "Moving Average Crossovers (Part II)."

  • Blue candles on the price pane show where TC (tomorrow's close) line crosses down through price -- a prediction that the short moving average (also blue) will cross up through the long moving average.
  • Yellow candles on the price pane show where the TC line crosses up through price -- a prediction that the long moving average (also yellow) will cross up through the short moving average.
  • Green candles on the price pane show where the TC line could cross through price -- based on previous changes in price.
  • Light gray candles on the price pane show where the TC line should not cross through price, because it is well outside previous actual changes in price.
  • Dark gray candles on the price pane show where the TC line cannot cross through price, because TC is below zero.
  • In addition to allowing you to adjust the periods of the short and long moving averages, the left toolbar of the price pane shows the following for all available history on the active symbol:

  • The total number of predictions that one moving average will move up through the other.
  • The percentage that this is confirmed by an actual crossover the following bar.
  • The percentage that this is confirmed by an actual crossover two bars later.
  • The percentage that this is confirmed by an actual crossover three bars later.
  • The percentage that the prediction and confirmation happen on the same bar (useless predictions).
  • The percentage that the prediction is not confirmed within three bars (failed predictions).
  • The percentage that the averages crossed when they could (green candle) without a prediction.
  • The percentage that the averages crossed when they should not (light gray candle) without a prediction.
  • Each is broken down by the direction of the cross with the short average crossing up through the long average listed first.

    To discuss this SnapSheet, please visit our Discussion Forums at www.SnapSheets.com, where online trainers are available for assistance.

    --Patrick Argo and Bruce Loebrich
    Worden Brothers, Inc.
    800 776-4940, www.worden.com
    GO BACK



    NEOTICKER: MOVING AVERAGE CROSSOVERS (PART II)

    "Moving Average Crossovers (Part II)" by Dimitris Tsokakis in this issue is a continuation of last month's moving average crossover prediction strategy. Two major concepts are presented: a population-wide comparison of predicted crosses and actual crosses; and second, moving average crossover predictions as applied on stochastics as well as data series.

  • Population of cross predictions vs. the actual crosses
    To collect population statistics, first create an intermediate indicator called "Tasc Cross Prediction and Actual Cross" (Listing 1). It returns two plots. Plot 1 returns a "1" on ascending predictions and returns a "-1" on descending predictions. Plot 2 returns a "1" on actual ascendings and a "-1" on actual descendings. This indicator accepts two integer moving average periods as inputs.
  • Next, create an indicator that collects and compares the results of predictions for the entire NDX population. This indicator will be called "TASC Composite SMA Cross" (Listing 2). This indicator returns four plots: descending cross predictions; descending crosses; ascending cross predictions; and ascending crosses. All four are percentages of stocks in the population that are producing ascending and descending crosses.

    To make this population chart in NeoTicker, create a time chart with all 100 symbols in the chart, then apply the "TASC Composite SMA Cross" indicator to it. It will then calculate and plot ascending and descending predictions, and actual crosses in a separate pane (Figure 7).
     


    FIGURE 7: NEOTICKER, PREDICTED AND ACTUAL CROSSOVERS. Here is the result of applying the "TASC Composite SMA Cross" indicator to a NeoTicker chart. Ascending and descending crossover predictions are calculated and plotted. Actual crosses appear in a separate pane.

  • Moving average predictions for moving average on stochastic

  • Use NeoTicker's indicator-on-indicator feature to get statistics of moving averages on stochastics, with no additional coding necessary. In the pattern scanner used to generate statistics from part 1 of Tsokakis' article, add a stochastic indicator to the list of indicators in the scanner and change the "TASC Cross Prediction Statistic" indicator to link to stochastics instead of the data series. After completing these changes, run the scan again. The new results will be based on stochastics rather than the underlying data (Figure 8).
     


    FIGURE 8: NEOTICKER, STOCHASTICS CROSSOVERS. Here are sample results of a scan based on stochastics rather than the underlying data.


    A downloadable version of all indicators and example charts will be available at the NeoTicker blog site (https://blog.neoticker.com).
     

    LISTING 1
    $P := param1;
    $K := param2;
    TC := ($P*($K-1)*average(data1,$K-1) -
           $K*($P-1)*average(data1,$P-1))/($K-$P);
    plot1 := xcross(TC, data1);
    plot2 := xcross(average(data1,$P), average(data1,$K));
    LISTING 2
    function tasc_compsmax : double;
    var composite : variant;
        i, DcrPR, Dcr, AcrPR, Acr : integer;
        DS_str, comp_str : string;
    begin
       DcrPR := 0;
       Dcr := 0;
       AcrPR := 0;
       Acr := 0;
       for i := 1 to DataSeries.Count do
       begin
          DS_str := '#' + ntlib.integer2str(i);
          comp_str := 'comp' + ntlib.integer2str(i);
          composite := ItSelf.MakeIndicator (comp_str, 'tasc_smaxcomp',
                                               [DS_str], [param1.str, param2.str]);
          if composite.valueex [1, 0] > 0 then AcrPR := AcrPR +1;
          if composite.valueex [1, 0] < 0 then DcrPR := DcrPR +1;
          if composite.valueex [2, 0] > 0 then Acr := Acr +1;
          if composite.valueex [2, 0] < 0 then Dcr := Dcr +1;
       end;
       itself.plot [1] := DcrPR/i*100;
       itself.plot [2] := Dcr/i*100;
       itself.plot [3] := AcrPR/i*100;
       itself.plot [4] := Acr/i*100;
    end;


    --Kenneth Yuen, TickQuest Inc.
    www.tickquest.com
    GO BACK



    AIQ: MOVING AVERAGE CROSSOVERS (PART II)

    The AIQ code for Dimitris Tsokakis' TC indicator described in parts 1 and 2 of his article, "Moving Average Crossovers," as well as a related trading system that I devised to test the indicator, are shown here.

    I used the NASDAQ 100 list of stocks and two simple trading systems. The first uses the traditional crossover of two moving averages of a stochastic indicator and buys when the %K crosses up from below %D. I used the author's suggested parameters of 20 and 30 days. I also set up a trading system that uses the TC1 indicator in the way the author suggests -- that is, when the TC1 crosses down from above through the %D, then a buy signal is generated. Short-sale trades use the reverse of these rules. My objective was to see if the approximate one-day lead on the crossovers that the TC1 usually provides would show a better return than using the traditional crossover of the %K and %D indicators.

    Using the AIQ EDS module, which tests all the trades on a one-share basis, I compared the long-side trades for a five-day fixed holding period and a three-day fixed holding period for the short-side trades. No other exit criteria were used.

    In Figure 9, I show the results of these fixed-period tests. TC1 shows improved results over the traditional use of %K and %D. Both tests were run using a trend filter on the NDX.
     


    FIGURE 9: AIQ, PREDICTIVE CROSSOVERS. Here are the results of a fixed-period test comparing traditional %K, %D crossovers versus TC1 crossovers. You can see that TC1 shows improved results over the traditional use of %K and %D.


    This code can be downloaded from the AIQ website at www.aiqsystems.com or copied and pasted from the STOCKS & COMMODITIES website at Traders.com.
     

    !! ANTICIPATING CROSSOVERS II
    ! Author: Dimitris Tsokakis, TASC, March 2007
    ! Coded by: Richard Denning 01/09/07
    C    is [close].
    P    is 20.
    K    is 30.
    ! STOCHASTICS & SK-SD [%K-%D]
    Define     L     21.       !(Default=21)
    Define     S2     10.     !(Default=10)
    Define     S3     10.      !(Default=10)
    Stoch     is 100*(([close] - loval([low],L)) /
        (hival([high],L) - loval([low],L))).
    SK     is SimpleAvg(Stoch,S2).    !Smoothed %K,
    SD     is SimpleAvg(SK,S3).         !Smoothed %D
    SK_1     is simpleavg(Stoch,K-1).
    SP_1     is simpleavg(Stoch,P-1).
    TC1 is (P * (K - 1) * SK_1 - K * (P - 1) * SP_1) / (K - P).
    ! TREND FILTER
    MA50    is simpleavg(C,50).
    TFLndx    is TickerRule("NDX",slope2(MA50,5) > 0).
    TFSndx    is TickerRule("NDX",slope2(MA50,5) < 0).
    ! MA CROSS OVERS SYSTEM (TRADITIONAL)
    LExu2    if SK > SD and valrule(SK < SD,1).
    SExd2    if SK < SD and valrule(SK > SD,1).
    ! TC1 CROSS OVER SYSTEM
    LEtc1xd    if TC1 < SD and valrule(TC1 > SD,1).
    SEtc1xu    if TC1 > SD and valrule(TC1 < SD,1).
    ! TRADING SYSTEM WITH TREND FILTER
    LExu3    if LExu2 and TFLndx.
    SExd3    if SExd2 and TFSndx.
    LEtcxd3    if LEtc1xd and TFLndx.
    SEtcxu3    if SEtc1xu and TFSndx.


    --Richard Denning
    AIQ Systems
    richard.denning@earthlink.net
    GO BACK



    TRADECISION: MOVING AVERAGE CROSSOVERS (PART II)

    In "Moving Average Crossovers (Part II)" in this issue, Dimitris Tsokakis further develops his cross-anticipation ideas and looks at the trading opportunities that arise as a result of decreasing the lag of the moving average (MA) crossover.

    The Function Builder in Tradecision enables you to recreate tomorrow's close (TC) custom function:
     

    function (Price:numeric,K:numeric,P:numeric):Numeric;
    return (P*(K-1)*SMA(Price,K-1)-K*(P-1)*SMA(Price,P-1))/(K-P);


    To predict the SMA crosses with stochastics, you need to create a new custom study by using the Study Builder. The following is the code for the study:
     

    var
       Stoch:= FastD(3);
       Tc1:= TomorrowsClose(Stoch,20,30);
    end_var
    return  CrossAbove(Stoch,Tc1) OR CrossBelow(Stoch,Tc1);


    To use this function and study in Tradecision, visit the Traders' Tips area at https://tradecision.com/support/tasc_tips/tasc_traders_tips.htm or copy the code from the STOCKS & COMMODITIES website at www.Traders.com.

    A sample chart is shown in Figure 10.
     


    FIGURE 10: TRADECISION, PROBABLE CROSSOVERS. Here's an example of using Dimitris Tsokakis' technique of predicting SMA crosses with stochastics using Tradecision's custom studies.
     


    --Alex Grechanowski
    Alyuda Research, Inc.
    alex@alyuda.com, 510 931-7808
    www.alyuda.com, www.tradecision.com
    GO BACK



    STRATASEARCH: MOVING AVERAGE CROSSOVERS (PART II)

    In this second part of "Moving Average Crossovers" by Dimitris Tsokakis, with the first part appearing in the February 2007 issue, we get a better feel for how this method can be used in practice. We also see how it can be opened up for use with other indicators. Being able to obtain your buy and sell signals a day earlier than you otherwise would can certainly open up some new trading opportunities.

    We tested several systems using the TC crossover approach to see how the results would compare to the original systems. In most cases, the average win increased and the average loss decreased when the TC crossover approach was used, just as expected. But perhaps more important, the impact of the TC crossover was seen more significantly in systems with shorter holding periods. This makes sense when you consider that a one-day lag will have a greater impact on a 10-day holding than a 100-day holding.

    A sample chart of the TC crossover is shown in Figure 11.
     

    FIGURE 11: STRATASEARCH, PROBABLE CROSSOVERS. The circled areas show how the TC crossover anticipates the standard crossover. This decrease in lag can help squeeze out additional profits.


    As with all our other StrataSearch Traders' Tips, additional information, including plug-ins, can be found in the Shared Area of our user forum. This month's plug-in also contains a number of prebuilt trading rules that will allow you to include this indicator in your automated searches. Simply install the plug-in and launch your automated search.
     

    //****************************************************************
    // Moving Average Crossovers (Part II)
    //****************************************************************
    C1 = parameter("Value");
    p = parameter("P Value");
    k = parameter("K Value");
    MAp = mov(C1, p, simple);
    MAk = mov(C1, k, simple);
    TC = (p*(k-1)*mov(C1, k-1, simple)-k*(p-1)*mov(C1, p-1, simple))/(k-p);
    AMA_TC2 = TC;


    --Pete Rast
    Avarin Systems Inc.
    www.StrataSearch.com
    GO BACK



    TRADINGSOLUTIONS: MOVING AVERAGE CROSSOVERS (PART II)

    In the article "Moving Average Crossovers (Part II)," Dimitris Tsokakis describes some functions and rules for detecting likely moving average crossovers.

    These functions can be entered into TradingSolutions as described below. They are also available as a function file that can be downloaded from the TradingSolutions website (www.tradingsolutions.com) in the Solution Library section. Also included is a function to combine all of the predictions into a single directional strength indicator.
     

    Function: MAC_Close
    Inputs: Close, Short Period, Long Period
    Div (Sub (Mult (Short Period , Mult (Sub (Long Period, 1),
     MAVL (Close, Sub (Long Period, 1), Long Period))),
     Mult (Long Period, Mult (Sub (Short Period, 1),
     MAVL (Close, Sub (Short Period, 1), Short Period)))),
     Sub (Long Period, Short Period))
    Function: MAC_AscPrediction
    Inputs: Close, Short Period, Long Period
    CrossAbove (Close, MAC_Close (Close, Short Period, Long Period))
    Function: MAC_DescPrediction
    Inputs: Close, Short Period, Long Period
    CrossBelow (Close, MAC_Close (Close, Short Period, Long Period))
    Function: MAC_LSCross
    Inputs: Close, Short Period, Long Period
    Cross (MA (Close, Short Period), MA (Close, Long Period))
    Function: MAC_Filter
    Inputs: Close, Short Period, Long Period, Filter Period
    Or (LT (MAC_Close (Close, Short Period, Long Period),
     Mult (Add (1, Div (Mult (2, Lowest (ROC (Close, 1, 1), Filter Period)), 100)), Close)),
     GT (MAC_Close (Close, Short Period, Long Period),
     Mult (Add (1,Div (Mult (2, Highest (ROC (Close, 1, 1), Filter Period)), 100)), Close)))
    Function: MAC_AscSoon
    Inputs: Close, Short Period, Long Period, Filter Period
    And (Not (MAC_Filter (Close, Short Period, Long Period, Filter Period)),
     And (Not (MAC_AscPrediction (Close, Short Period, Long Period)),
     And (Not (MAC_DescPrediction (Close, Short Period, Long Period)),
     And (Not (MAC_LSCross (Close, Short Period, Long Period)),
     And (GT (BarsSinceUL (MAC_LSCross (Close, Short Period, Long Period)), 3),
     GT (MAC_Close (Close, Short Period, Long Period), Close))))))
    Function: MAC_DescSoon
    Inputs: Close, Short Period, Long Period, Filter Period
    And (Not (MAC_Filter (Close, Short Period, Long Period, Filter Period)),
     And (Not (MAC_AscPrediction (Close, Short Period, Long Period)),
     And (Not (MAC_DescPrediction (Close, Short Period, Long Period)),
     And (Not (MAC_LSCross (Close, Short Period, Long Period)),
     And (GT (BarsSinceUL (MAC_LSCross (Close, Short Period, Long Period)), 3),
     LT (MAC_Close (Close, Short Period, Long Period), Close))))))
    Function MAC_CombinedPrediction
    Inputs: Close, Short Period, Long Period, Filter Period
    If (MAC_AscPrediction (Close, Short Period, Long Period), 2,
     If (MAC_AscSoon (Close, Short Period, Long Period, Filter Period), 1,
     If (MAC_DescSoon (Close, Short Period, Long Period, Filter Period), -1,
     If (MAC_DescPrediction (Close, Short Period, Long Period), -2, 0))))


    --Gary Geniesse
    NeuroDimension, Inc.
    800 634-3327, 352 377-5144
    www.tradingsolutions.com
    GO BACK



    VT TRADER: MOVING AVERAGE CROSSOVERS (PART II)

    This month's Traders' Tip article expands on last month's article, "Anticipating Moving Average Crossovers," by Dimitris Tsokakis. This month, Tsokakis once again discusses the benefits of being able to accurately anticipate moving average crossovers. He also discusses how the anticipation of crossovers can be used along with other indicators such as the slow stochastic and the RSI.
     

    The VT Trader code and instructions for creating it are as follows (input variables are 
    parameterized to allow customization):
    1. Navigator Window>Tools>Trading Systems Builder>[New] button
    2. In the Indicator Bookmark, type the following text for each field:
    Name: TASC - 03/2007 - "Decrease The Lag, Up The Trading, Moving Average Crossovers (Part II)"
    Short Name: vt_AMACSTOCH
    Label Mask: TASC - 03/2007 - "Decrease The Lag, Up The Trading, Moving Average Crossovers (Part II)"
    3. In the Input Bookmark, create the following variables:
     
        [New] button... Name: K , Display Name: %K Periods , Type: integer , Default: 14
        [New] button... Name: Sl , Display Name: %K Slowing Periods , Type: integer , Default: 3
        [New] button... Name: D , Display Name: %D Periods , Type: integer , Default: 3
        [New] button... Name: _p , Display Name: MAp Periods , Type: integer , Default: 20
    [New] button... Name: _k , Display Name: MAk Periods , Type: integer , Default: 30
    4. In the Formula Bookmark, copy and paste the following formula:
    {Provided By: Visual Trading Systems, LLC (c) Copyright 2007}
    {Description: Decrease The Lag, Up The Trading, Moving Average Crossovers (Part II by Dimitris Tsokakis}
    {Notes: March 2007 Issue - Decrease The Lag, Up The Trading, Moving Average Crossovers (Part II)}
    {vt_AMACSTOCH Version 1.0}
    {Slow Stochastic}
    StK:= ((C-LLV(L,K))/(HHV(H,K)-LLV(L,K)))*100;
    StDK:= Mov(StK,Sl,S);
    StDD:= Mov(StDK,D,S);
    _StDD:= Mov(StDK,D,S);
    {The TC Indicators}
    MAp:= mov(StDK,_p,S);
    MAk:= mov(StDK,_k,S);
    TC:= (_p*(_k-1)*mov(StDK,_k-1,S)-_k*(_p-1)*mov(StDK,_p-1,S))/(_k-_p);
    {SMA Cross Prediction/Confirmation Signals}
    DescCrossPrediction:= Cross(TC,_StDD);
    AscCrossPrediction:= Cross(_StDD,TC);
    ConfirmedDesc:= Cross(MAk,MAp);
    ConfirmedAsc:= Cross(MAp,MAk);
    {SMA Cross Prediction/Confirmation Signals}
    DescCrossPrediction:= Cross(TC,_Close);
    AscCrossPrediction:= Cross(_Close,TC);
    ConfirmedDesc:= Cross(MAk,MAp);
    ConfirmedAsc:= Cross(MAp,MAk);
    {SMA Cross Prediction Statistics}
    DescTotalPredictions:= Cum(DescCrossPrediction);
    Accurate0DescPredictions:= Cum(ConfirmedDesc AND Ref(DescCrossPrediction,-1));
    Accurate1DescPredictions:= Cum(ConfirmedDesc AND Ref(DescCrossPrediction,-2));
    Accurate2DescPredictions:= Cum(ConfirmedDesc AND Ref(DescCrossPrediction,-3));
    UselessDescPredictions:= Cum(ConfirmedDesc AND DescCrossPrediction);
    AscTotalPredictions:= Cum(AscCrossPrediction);
    Accurate0AscPredictions:= Cum(ConfirmedAsc AND Ref(AscCrossPrediction,-1));
    Accurate1AscPredictions:= Cum(ConfirmedAsc AND Ref(AscCrossPrediction,-2));
    Accurate2AscPredictions:= Cum(ConfirmedAsc AND Ref(AscCrossPrediction,-3));
    UselessAscPredictions:= Cum(ConfirmedAsc AND AscCrossPrediction);
    Acc0Desc:= 100*Accurate0DescPredictions/DescTotalPredictions;
    Acc1Desc:= 100*Accurate1DescPredictions/DescTotalPredictions;
    Acc2Desc:= 100*Accurate2DescPredictions/DescTotalPredictions;
    UselessDesc:= 100*UselessDescPredictions/DescTotalPredictions;
    FalseDesc:= 100-Acc0Desc-Acc1Desc-Acc2Desc-UselessDesc;
    Acc0Asc:= 100*Accurate0AscPredictions/AscTotalPredictions;
    Acc1Asc:= 100*Accurate1AscPredictions/AscTotalPredictions;
    Acc2Asc:= 100*Accurate2AscPredictions/AscTotalPredictions;
    UselessAsc:= 100*UselessAscPredictions/AscTotalPredictions;
    FalseAsc:= 100-Acc0Asc-Acc1Asc-Acc2Asc-UselessAsc;
    {Create Auto-Trading Functionality}
    OpenBuy:= AscCrossPrediction and (eventCount('OpenBuy')=eventCount('CloseBuy'));
    CloseBuy:= DescCrossPrediction and (eventCount('OpenBuy')>eventCount('CloseBuy'));
    OpenSell:= DescCrossPrediction and (eventCount('OpenSell')=eventCount('CloseSell'));
    CloseSell:= AscCrossPrediction and (eventCount('OpenSell')>eventCount('CloseSell'));
    5. In the Output Bookmark, create the following variables:
        [New] button...
    Var Name: StDD
    Name: Slow Stochastic %D
    * Checkmark: Indicator Output
    Select Indicator Output Bookmark
    Color: yellow
    Line Width: slightly thicker
    Line Style: solid
    Placement: Additional Frame 1
        [OK] button...
    [New] button...
    Var Name: MAp
    Name: MAp
    * Checkmark: Indicator Output
    Select Indicator Output Bookmark
    Color: blue
    Line Width: thin
    Line Style: solid
    Placement: Additional Frame 1
    [OK] button...
    [New] button...
    Var Name: MAk
    Name: MAk
    * Checkmark: Indicator Output
    Select Indicator Output Bookmark
    Color: red
    Line Width: thin
    Line Style: solid
    Placement: Additional Frame 1
    [OK] button...
    [New] button...
    Var Name: _StDD
    Name: Slow Stochastic %D (display duplicate)
    * Checkmark: Indicator Output
    Select Indicator Output Bookmark
    Color: yellow
    Line Width: slightly thicker
    Line Style: solid
    Placement: Additional Frame 2
        [OK] button...
    [New] button...
    Var Name: TC
    Name: TC
    * Checkmark: Indicator Output
    Select Indicator Output Bookmark
    Color: red
    Line Width: thin
    Line Style: dashed
    Placement: Additional Frame 2
    [OK] button...
    [New] button...
    Var Name: DescCrossPrediction
    Name: DescCrossPrediction
    Description: Decending MA Cross Prediction
    * Checkmark: Graphic Enabled
    * Checkmark: Alerts Enabled
    Select Graphic Bookmark
    Font [...]: Down Arrow
    Size: small
    Color: dark red
    Symbol Position: Above price plot
    Select Alerts Bookmark
    Alerts Message: Decending MA Cross Prediction
    Choose sound for audible alert
    [OK] button...
    [New] button...
    Var Name: AscCrossPrediction
    Name: AscCrossPrediction
    Description: Ascending MA Cross Prediction
    * Checkmark: Graphic Enabled
    * Checkmark: Alerts Enabled
    Select Graphic Bookmark
    Font [...]: Exit Sign
    Size: small
    Color: dark blue
    Symbol Position: Below price plot
    Select Alerts Bookmark
    Alerts Message: Ascending MA Cross Prediction
    Choose sound for audible alert
    [OK] button...
    [New] button...
    Var Name: ConfirmedDesc
    Name: ConfirmedDesc
    Description: Decending MA Cross Confirmed!
    * Checkmark: Graphic Enabled
    * Checkmark: Alerts Enabled
    Select Graphic Bookmark
    Font [...]: Down Arrow
    Size: medium
    Color: red
    Symbol Position: Above price plot
    Select Alerts Bookmark
    Alerts Message: Decending MA Cross Confirmed!
    Choose sound for audible alert
    [OK] button...
    [New] button...
    Var Name: ConfirmedAsc
    Name: ConfirmedAsc
    Description: Ascending MA Cross Confirmed!
    * Checkmark: Graphic Enabled
    * Checkmark: Alerts Enabled
    Select Graphic Bookmark
    Font [...]: Exit Sign
    Size: medium
    Color: blue
    Symbol Position: Below price plot
    Select Alerts Bookmark
    Alerts Message: Ascending MA Cross Confirmed!
    Choose sound for audible alert
    [OK] button...
    [New] button...
    Var Name: DescTotalPredictions
    Name: Total # of Desc Predictions
    * Checkmark: Indicator Output
    Select Indicator Output Bookmark
    Color: black
    Line Width: thin
    Line Style: solid
    Placement: Additional Frame 5
    [New] button...
    Var Name: Acc0Desc
    Name: Acc0 Desc %
    * Checkmark: Indicator Output
    Select Indicator Output Bookmark
    Color: black
    Line Width: thin
    Line Style: solid
    Placement: Additional Frame 5
    [New] button...
    Var Name: Acc1Desc
    Name: Acc1 Desc %
    * Checkmark: Indicator Output
    Select Indicator Output Bookmark
    Color: black
    Line Width: thin
    Line Style: solid
    Placement: Additional Frame 5
    [New] button...
    Var Name: Acc2Desc
    Name: Acc2 Desc %
    * Checkmark: Indicator Output
    Select Indicator Output Bookmark
    Color: black
    Line Width: thin
    Line Style: solid
    Placement: Additional Frame 5
    [New] button...
    Var Name: UselessDesc
    Name: Useless Desc %
    * Checkmark: Indicator Output
    Select Indicator Output Bookmark
    Color: black
    Line Width: thin
    Line Style: solid
    Placement: Additional Frame 5
    [New] button...
    Var Name: FalseDesc
    Name: False Desc %
    * Checkmark: Indicator Output
    Select Indicator Output Bookmark
    Color: black
    Line Width: thin
    Line Style: solid
    Placement: Additional Frame 5
    [New] button...
    Var Name: AscTotalPredictions
    Name: Total # of Asc Predictions
    * Checkmark: Indicator Output
    Select Indicator Output Bookmark
    Color: black
    Line Width: thin
    Line Style: solid
    Placement: Additional Frame 5
    [New] button...
    Var Name: Acc0Asc
    Name: Acc0 Asc %
    * Checkmark: Indicator Output
    Select Indicator Output Bookmark
    Color: black
    Line Width: thin
    Line Style: solid
    Placement: Additional Frame 5
    [New] button...
    Var Name: Acc1Asc
    Name: Acc1 Asc %
    * Checkmark: Indicator Output
    Select Indicator Output Bookmark
    Color: black
    Line Width: thin
    Line Style: solid
    Placement: Additional Frame 5
    [New] button...
    Var Name: Acc2Asc
    Name: Acc2 Asc %
    * Checkmark: Indicator Output
    Select Indicator Output Bookmark
    Color: black
    Line Width: thin
    Line Style: solid
    Placement: Additional Frame 5
    [New] button...
    Var Name: UselessAsc
    Name: Useless Asc %
    * Checkmark: Indicator Output
    Select Indicator Output Bookmark
    Color: black
    Line Width: thin
    Line Style: solid
    Placement: Additional Frame 5
    [New] button...
    Var Name: FalseAsc
    Name: False Asc %
    * Checkmark: Indicator Output
    Select Indicator Output Bookmark
    Color: black
    Line Width: thin
    Line Style: solid
    Placement: Additional Frame 5
    [New] button...
    Var Name: OpenBuy
    Name: OpenBuy
    Description: Automated Open Buy Trade Command
    * Checkmark: Trading Enabled
    Select Trading Bookmark
    Trade Action: Buy
    Traders Range: 5
    Hedge: no checkmark
    EachTick Count: 1
    [OK] button...
    [New] button...
    Var Name: CloseBuy
    Name: CloseBuy
    Description: Automated Close Buy Trade Command
    * Checkmark: Trading Enabled
    Select Trading Bookmark
    Trade Action: Sell
    Traders Range: 5
    Hedge: no checkmark
    EachTick Count: 1
    [OK] button...
    [New] button...
    Var Name: OpenSell
    Name: OpenSell
    Description: Automated Open Sell Trade Command
    * Checkmark: Trading Enabled
    Select Trading Bookmark
    Trade Action: Sell
    Traders Range: 5
    Hedge: no checkmark
    EachTick Count: 1
    [OK] button...
    [New] button...
    Var Name: CloseSell
    Name: CloseSell
    Description: Automated Close Sell Trade Command
    * Checkmark: Trading Enabled
    Select Trading Bookmark
    Trade Action: Buy
    Traders Range: 5
    Hedge: no checkmark
    EachTick Count: 1
    [OK] button...
    6. Click the "Save" icon to finish building this trading system. To attach this trading system
       to a chart right-click with the mouse within the chart window, select "Add Trading System" ->
       TASC - 03/2007 - "Decrease The Lag, Up The Trading, MA Crossovers (Part II)" from the list.
       Once attached to the chart the parameters can be customized by right-clicking with the mouse
       over the displayed trading system label and selecting "Edit Trading Systems Properties".
    
    
    To attach this trading system to a chart, right-click within the chart window and select this trading system from the list. Once it's attached to the chart, the parameters can be customized by right-clicking over the trading system label and selecting "Edit Trading Systems Properties."

    We'll be offering this trading system, "Anticipation crossover of MAs of the slow stochastic %D," for download in our user forums.

    A sample chart is shown in Figure 12. To learn more about VT Trader, visit www.cmsfx.com.

    FIGURE 12: VT TRADER, PROBABLE CROSSOVERS. Here is a sample USD/JPY 30-minute candlestick chart with the trading system appended. Small arrows indicate the stochastic MA predictions while larger arrows indicate the actual stochastic MA crossings. The Inspect Window allows the user to view the stochastic MA cross prediction statistics.


    --Chris Skidmore
    Visual Trading Systems, LLC (courtesy of CMS Forex)
    (866) 51-CMSFX, trading@cmsfx.com
    www.cmsfx.com
    GO BACK


    Return to March 2007 Contents

    Originally published in the March 2007 issue of Technical Analysis of STOCKS & COMMODITIES magazine. All rights reserved. © Copyright 2007, Technical Analysis, Inc.