Thanks very much in advance !!
SMAA_MIDDLE_TRADE - Enhancement
Moderator: moderators
- christhlo2
- rank: <50 posts

- Posts: 25
- Joined: Thu May 18, 2006 7:03 am
- Reputation: 0
- Gender:

SMAA_MIDDLE_TRADE - Enhancement
I am a newbie here, so I may have missed out certain function for the SMAA_Middle_Trade to work for the TS platform, can anyone help?
Thanks very much in advance !!
Thanks very much in advance !!
Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.
Thank you for your support.
- TheRumpledOne
- rank: 10000+ posts

- Posts: 15761
- Joined: Sun May 14, 2006 9:31 pm
- Reputation: 3048
- Location: Oregon
- Real name: Avery T. Horton, Jr.
- Gender:

- Contact:
This should work:
{ _SMAA_MIDDLE_TRADE }
{Attn: TradeStation
if this indicator is posted on the TradeStation Forum, I, TheRumpledOne, did NOT post it there,
so I can't be blamed for this indicator having my contact info.}
{Programmer: Avery T. Horton, Jr. aka TheRumpledOne,
gifts and donations accepted, PO Box 43575, Tucson, AZ 85733 }
{ © Copyright 2006 Avery T. Horton, Jr.}
inputs:
iPlot("R"),
iMiddle( (High + Low) * .50 ),
Length( 1),
Displace( 0 ),
iMsgLong("LONG"),
iMsgShort("SHORT"),
iMsgFlat("FLAT"),
iMsgXAbove("XA"),
iMsgXBelow("XB"),
iLgColor(cyan),
iShColor(magenta),
iWaitColor(white),
iUpColor(cyan),
iDnColor(magenta);
inputs:
iPrice( close ),
iInd( xaverage(close,5) ),
iBarsBack(1),
iAboveColor( darkblue ),
iBelowColor( darkmagenta ),
iIndRisingColor( cyan ),
iIndFallingColor( magenta ) ;
Inputs:
iPeriods( 30 ),
iDecimals(2);
variables:
tMid(""),
tMsg(""),
PLTop( 0 ),
PLBottom( 0 ),
DayTop( 0 ),
DayBottom( 0 ),
DayHigh( 0 ),
PrevDayMid( 0 ),
DayLow( 0 ),
xPeriods(60),
xInterval(0),
sFirstPass(true),
xBars(0),
xInd(0),
tInd(""),
tAlert("");
variables:
FG1(white),
BG1(black),
fg2(white),
bg2(black),
fg3(white),
bg3(black),
fg4(white),
bg4(black);
{commentary variables}
variables:
xcomm(0),
oComm1( "" ),
oComm2( "" ),
oComm3( "" ),
oComm4( "" ),
oComm5( "" ),
oComm6( "" ),
oComm7( "" ),
oComm8( "" ),
oComm9( "" ),
oComm10( "" );
variables:
xColor1FG(white);
variables:
xDate(0),
xTime(0),
xOpen(0),
xClose(0),
xHigh(0),
xLow(0);
{first time through}
if sFirstPass
then begin
sFirstPass = false;
{bar test}
If bartype = 4
then xInterval = 94
else
If bartype = 3
then xInterval = 93
else
If bartype = 2
then xInterval = 92
else
If bartype = 1
then begin
xInterval = BarInterval;
end; { If bartype = 1 }
end; {if sFirstPass}
{ INITIALIZE }
FG1 = iWaitColor;
BG1 = BLACK;
fg2 = WHITE;
bg2 = BLACK;
fg3 = WHITE;
bg3 = BLACK;
fg4 = WHITE;
bg4 = BLACK;
tInd = "";
tAlert = "WAIT ";
xDate = Date ;
xTime = Time ;
xOpen = Open;
xClose = Close;
xHigh = High;
xLow = Low;
{ PROCESSING }
PrevDayMid = iMiddle[1] ;
If close crosses above PrevDayMid
or close crosses below PrevDayMid
then xBars = 1
else xBars = xBars + 1;
// xBars = _fBarsSinceXover( close, PrevDayMid, iPeriods) ;
{ Alert criteria }
If iMiddle > iMiddle[1]
then begin
tMid = "LONG";
Fg2 = iUpColor;
Bg2 = BLACK;
end
else
If iMiddle <iMiddle>= iInd
then begin
If iInd >= iInd[iBarsBack]
then begin
tInd = "LONG " ;
Fg3 = iIndRisingColor ;
end
else begin
tInd = "LONG " ;
Fg3 = iAboveColor ;
end ;
end;
If iPrice < iInd
then begin
If iInd <iInd> PrevDayMid
then begin
tMsg = "Above Mid " + Numtostr(close - PrevDayMid , idecimals) ;
end
else
If CLOSE <PrevDayMid> PrevDayMid
then begin
Fg4 = BLACK;
Bg4 = green;
end
else
If CLOSE < PrevDayMid
then begin
Fg4 = BLACK;
Bg4 = red;
end
else begin
Fg4 = magenta;
Bg4 = white;
end;
{ Alert }
if tAlert <> "wait "
and tAlert <> tAlert[1]
then Alert( tAlert + Numtostr( PrevDayMid , idecimals)) ;
{ PLOT }
if UpperStr(iPlot) = "R"
then begin
Plot1( tAlert + " " + tMsg , "Trade", fg1 ) ;
SetPlotBGColor( 1, bg1);
Plot2( iMiddle[1] , "MidPoint", fg2 ) ;
SetPlotBGColor( 2, bg2);
Plot3( iInd, "Ind", fg3 ) ;
SetPlotBGColor( 3, bg3);
Plot4( xBars , "Middle", fg4 ) ;
SetPlotBGColor( 4, bg4 );
end; // if UpperStr(iPlot) = "R"
if UpperStr(iPlot) <> "R"
then begin
Plot4( iMiddle , "Middle", fg1 ) ;
SetPlotBGColor( 4, bg1);
end ;
xComm = _fCommentary(oComm1, oComm2, oComm3, oComm4, oComm5, oComm6, oComm7, oComm8, oComm9, oComm10);
CommentaryCl(oComm1 );
CommentaryCl(oComm2 );
CommentaryCl(oComm3 );
CommentaryCl(oComm4 );
CommentaryCl(oComm5 );
CommentaryCl(oComm6 );
CommentaryCl(oComm7 );
CommentaryCl(oComm8 );
CommentaryCl(oComm9 );
CommentaryCl(oComm10 );
CommentaryCl( "iPrice: ", NumToStr( iPrice , iDecimals) );
CommentaryCl( "iMiddle: ", NumToStr( iMiddle , iDecimals) );
CommentaryCl( "iInd: ", NumToStr( iInd , iDecimals) );
{ _SMAA_MIDDLE_TRADE }
{Attn: TradeStation
if this indicator is posted on the TradeStation Forum, I, TheRumpledOne, did NOT post it there,
so I can't be blamed for this indicator having my contact info.}
{Programmer: Avery T. Horton, Jr. aka TheRumpledOne,
gifts and donations accepted, PO Box 43575, Tucson, AZ 85733 }
{ © Copyright 2006 Avery T. Horton, Jr.}
inputs:
iPlot("R"),
iMiddle( (High + Low) * .50 ),
Length( 1),
Displace( 0 ),
iMsgLong("LONG"),
iMsgShort("SHORT"),
iMsgFlat("FLAT"),
iMsgXAbove("XA"),
iMsgXBelow("XB"),
iLgColor(cyan),
iShColor(magenta),
iWaitColor(white),
iUpColor(cyan),
iDnColor(magenta);
inputs:
iPrice( close ),
iInd( xaverage(close,5) ),
iBarsBack(1),
iAboveColor( darkblue ),
iBelowColor( darkmagenta ),
iIndRisingColor( cyan ),
iIndFallingColor( magenta ) ;
Inputs:
iPeriods( 30 ),
iDecimals(2);
variables:
tMid(""),
tMsg(""),
PLTop( 0 ),
PLBottom( 0 ),
DayTop( 0 ),
DayBottom( 0 ),
DayHigh( 0 ),
PrevDayMid( 0 ),
DayLow( 0 ),
xPeriods(60),
xInterval(0),
sFirstPass(true),
xBars(0),
xInd(0),
tInd(""),
tAlert("");
variables:
FG1(white),
BG1(black),
fg2(white),
bg2(black),
fg3(white),
bg3(black),
fg4(white),
bg4(black);
{commentary variables}
variables:
xcomm(0),
oComm1( "" ),
oComm2( "" ),
oComm3( "" ),
oComm4( "" ),
oComm5( "" ),
oComm6( "" ),
oComm7( "" ),
oComm8( "" ),
oComm9( "" ),
oComm10( "" );
variables:
xColor1FG(white);
variables:
xDate(0),
xTime(0),
xOpen(0),
xClose(0),
xHigh(0),
xLow(0);
{first time through}
if sFirstPass
then begin
sFirstPass = false;
{bar test}
If bartype = 4
then xInterval = 94
else
If bartype = 3
then xInterval = 93
else
If bartype = 2
then xInterval = 92
else
If bartype = 1
then begin
xInterval = BarInterval;
end; { If bartype = 1 }
end; {if sFirstPass}
{ INITIALIZE }
FG1 = iWaitColor;
BG1 = BLACK;
fg2 = WHITE;
bg2 = BLACK;
fg3 = WHITE;
bg3 = BLACK;
fg4 = WHITE;
bg4 = BLACK;
tInd = "";
tAlert = "WAIT ";
xDate = Date ;
xTime = Time ;
xOpen = Open;
xClose = Close;
xHigh = High;
xLow = Low;
{ PROCESSING }
PrevDayMid = iMiddle[1] ;
If close crosses above PrevDayMid
or close crosses below PrevDayMid
then xBars = 1
else xBars = xBars + 1;
// xBars = _fBarsSinceXover( close, PrevDayMid, iPeriods) ;
{ Alert criteria }
If iMiddle > iMiddle[1]
then begin
tMid = "LONG";
Fg2 = iUpColor;
Bg2 = BLACK;
end
else
If iMiddle <iMiddle>= iInd
then begin
If iInd >= iInd[iBarsBack]
then begin
tInd = "LONG " ;
Fg3 = iIndRisingColor ;
end
else begin
tInd = "LONG " ;
Fg3 = iAboveColor ;
end ;
end;
If iPrice < iInd
then begin
If iInd <iInd> PrevDayMid
then begin
tMsg = "Above Mid " + Numtostr(close - PrevDayMid , idecimals) ;
end
else
If CLOSE <PrevDayMid> PrevDayMid
then begin
Fg4 = BLACK;
Bg4 = green;
end
else
If CLOSE < PrevDayMid
then begin
Fg4 = BLACK;
Bg4 = red;
end
else begin
Fg4 = magenta;
Bg4 = white;
end;
{ Alert }
if tAlert <> "wait "
and tAlert <> tAlert[1]
then Alert( tAlert + Numtostr( PrevDayMid , idecimals)) ;
{ PLOT }
if UpperStr(iPlot) = "R"
then begin
Plot1( tAlert + " " + tMsg , "Trade", fg1 ) ;
SetPlotBGColor( 1, bg1);
Plot2( iMiddle[1] , "MidPoint", fg2 ) ;
SetPlotBGColor( 2, bg2);
Plot3( iInd, "Ind", fg3 ) ;
SetPlotBGColor( 3, bg3);
Plot4( xBars , "Middle", fg4 ) ;
SetPlotBGColor( 4, bg4 );
end; // if UpperStr(iPlot) = "R"
if UpperStr(iPlot) <> "R"
then begin
Plot4( iMiddle , "Middle", fg1 ) ;
SetPlotBGColor( 4, bg1);
end ;
xComm = _fCommentary(oComm1, oComm2, oComm3, oComm4, oComm5, oComm6, oComm7, oComm8, oComm9, oComm10);
CommentaryCl(oComm1 );
CommentaryCl(oComm2 );
CommentaryCl(oComm3 );
CommentaryCl(oComm4 );
CommentaryCl(oComm5 );
CommentaryCl(oComm6 );
CommentaryCl(oComm7 );
CommentaryCl(oComm8 );
CommentaryCl(oComm9 );
CommentaryCl(oComm10 );
CommentaryCl( "iPrice: ", NumToStr( iPrice , iDecimals) );
CommentaryCl( "iMiddle: ", NumToStr( iMiddle , iDecimals) );
CommentaryCl( "iInd: ", NumToStr( iInd , iDecimals) );
- christhlo2
- rank: <50 posts

- Posts: 25
- Joined: Thu May 18, 2006 7:03 am
- Reputation: 0
- Gender:

will not verify in TS 81
will not verify in TS 81
word nor recognised by TS
How do I fix this?
thanks,
dad8
word nor recognised by TS
How do I fix this?
thanks,
dad8
Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.
Thank you for your support.