Page 1 of 2

TRO ABOVE BELOW INDICATOR

Posted: Tue Sep 26, 2006 11:35 pm
by TheRumpledOne
TRO_AboveBelow

I was looking at $TIKQ on the 1 minute interval today. Couldn't see a clear picture.

So I created TRO_AboveBelow to count how many bars $TIKQ was above/below the 0 threshold line. Then I checked out how many times AAPL was above/below the previous day's middle.

Of course, the threshold is an input so you can use TRO_AboveBelow to track just about anything.



ELD attached.

Posted: Thu Sep 28, 2006 5:38 pm
by EchoTrader
Avery, someone just published a very interesting code i though you may like to see on the subject of chart tick formation based on 3rd party software at this address:

https://www.TradeStation.com/Discussion ... _ID=261317
and also http://www.surinotes.com/video/marketde ... delta.html

i have missed your remarkable posts on the TS forum, things will never be the same without you being there…..

Posted: Fri Sep 29, 2006 5:03 pm
by TheRumpledOne
says the TS topic was deleted.

Posted: Fri Sep 29, 2006 7:51 pm
by EchoTrader
i don’t know why the link doesn’t works but regardless the code is posted bellow…….
Tony

Ps: is true that you’re writing a book called Trapline Trading (TT)
Method to be released in November published by Mark Crisp? If it is true, how can I get a copy?

{
060921 modification:
concept: Threshold-free 'dynamic' coloring option obviates setting instrument-specific threshold.
parameter controlled by useThreshold(binary) input

060921 modification:
concept: Setting to option for exponential color gradient instead of linear gradient.
parameter controlled by useLogColorGradient(binary) input
hopefully, at about 60% of x's range, these parameters make the color gradient accelerate 'uphill'
using
fx = a * (B^(b(x+c)) + d
fx = .2 * (1.7 ^ (7.8((absBidAskDelta / xtremeDelta) - .6))
fx = .2 * (Power(1.7 , (7.8 * ((absBidAskDelta / xtremeDelta) - .6))) //EL Correct ????

a =0.2
b = 7.8
c = -0.6
d = 0.0
B = 1.7



could definitely be modified / improved further
especially to the use of dropping the largest absBidAskDelta and using an avg of the next four largest absBidAskDelta extremes
maybe something using a central tendency of absolute volume
need to make it more 'neighborhood' specific instead of using extremes since opening this instance... will maybe look at fitting absBidAskDelta to blocks of time throughout day, since sometimes extremes are set early in the day - tending to wash out / fade the coloring for the rest of the day, etc.

Suggestions and improvements are welcomed

}

inputs:
DisplayDelta( false ),
Type( 1 ), // 1 = Use Upticks/Downticks, 2 = Use Bid/Ask
useThresholds(0), // 1 yes (legacy) , 0 no (create 'dynamic' thresholds)

Threshold1( 150 ),
Threshold2( 300 ),
Threshold3( 600 ),

useLogColorGradient(1), // 1 yes -> non extremes bland,emphasizes extremes more 0 no -> straight linear gradient
colLimit(165), // decrease to prevent colors from getting too dark to read against a dark background,etc

BidAskArraySz( 1000 )
;

variables:
TickSize( MinMove / PriceScale ),
PriceAtIndex( Open ),
BaseIndex( BidAskArraySz/2 ),
Red1(RGB(255,185,185)),
Red2(RGB(255,128,128)),
Red3(RGB(255,0,0)),
Red4(RGB(128,0,0)),
Green1(RGB(210,255,210)),
Green2(RGB(125,255,125)),
Green3(RGB(0,255,0)),
Green4(RGB(0,128,0)),
i( 0 ),

// dynamic coloring vars
xtremeDelta(1),
absBidAskDelta(0),
wkColReg(0)
;

variables:
intrabarpersist Price( 0 ),
intrabarpersist MyVol( 0 ),
intrabarpersist VolTmp( 0 ),
intrabarpersist LastTick( 0 ),
intrabarpersist MyCurrentBar( 0 ),
intrabarpersist Index( 0 ),
intrabarpersist BidAskDelta( 0 ),
intrabarpersist xDelta( 0 ),
intrabarpersist TextString(""),
intrabarpersist MyUpTicks( 0 ),
intrabarpersist MyDownTicks( 0 )
;

Arrays:
intrabarpersist Bid[](0),
intrabarpersist Ask[](0),

// dynamic coloring array holds largest five, lowest four used in average of them
arrXtrmDeltas[5](10)
;

Array_SetMaxIndex( Bid, BidAskArraySz );
Array_SetMaxIndex( Ask, BidAskArraySz );

if (Type = 1 or Type = 2) and LastBarOnChart and BarType < 2 then
begin
MyVol = Ticks;
PriceAtIndex = Open;

if CurrentBar > MyCurrentBar then
begin
VolTmp = 0;
MyCurrentBar = CurrentBar;
MyUpTicks = 0;
MyDownTicks = 0;

for i = 0 to BidAskArraySz - 1
begin
Bid<i> = 0;
Ask<i> = 0;
end;
end;

Index = BaseIndex + (Close - PriceAtIndex) / TickSize;

if InsideBid < InsideAsk then
begin
if Type = 1 then
begin
// Use Upticks/Downticks
if DownTicks <> MyDownTicks then
Bid[Index] = Bid[Index] + MyVol - VolTmp
else if UpTicks <> MyUpTicks then
Ask[Index] = Ask[Index] + MyVol - VolTmp
else
begin
if Close <= LastTick then
Bid[Index] = Bid[Index] + MyVol - VolTmp
else
Ask[Index] = Ask[Index] + MyVol - VolTmp;
end;
end
else // Type = 2
begin
// Use Bid/Ask
// Warning: TradeStation provides snapshot of bid/ask
if Close <= InsideBid then
Bid[Index] = Bid[Index] + MyVol - VolTmp
else if Close >= InsideAsk then
Ask[Index] = Ask[Index] + MyVol - VolTmp
else
begin
// Last tick was between bid/ask
if Close <= LastTick then
Bid[Index] = Bid[Index] + MyVol - VolTmp
else
Ask[Index] = Ask[Index] + MyVol - VolTmp;
end;
end;
end;

MyUpTicks = UpTicks;
MyDownTicks = DownTicks;
VolTmp = MyVol;
LastTick = Close;

xDelta = 0;
Price = Low;

while Price <= High
begin
Index = BaseIndex + (Price - PriceAtIndex) / TickSize;
TextString = NumToStr(Bid[Index],0) + " x " + NumToStr(Ask[Index],0);
Value99 = Text_New(Date, Time, 0, " ");
Text_SetString(Value99, TextString);
Text_SetLocation(Value99, Date, Time, Price);
Text_SetStyle(Value99, 1, 1);

BidAskDelta = Ask[Index] - Bid[Index];

if useThresholds = 0 then begin
absBidAskDelta = absvalue(BidAskDelta);

value1 = SortArray(arrXtrmDeltas, 5, -1); // -1 -> sort asc

if absBidAskDelta > arrXtrmDeltas[1] then
arrXtrmDeltas[1] = absBidAskDelta; // stick it in to replace lowest

value1 = SortArray(arrXtrmDeltas, 5, -1); // -1 asc 1 des to get the lowest four again

xtremeDelta = AverageArray(arrXtrmDeltas,4) * .75; // only use the lowest four leave out hugest one
{same as
sumArr = 0;
for inc = 1 to 4 begin // avg the smallest four
sumArr = sumArr + arrXtrmDeltas(inc);

end; // for inc = 1 to 4

xtremeDelta = sumArr * .25; //inline better?
}

{note re: * .75 this could be a factor that slides up dn by time of day}

if absBidAskDelta > xtremeDelta then // to keep ratio at or under 1.0
absBidAskDelta = xtremeDelta;


if useLogColorGradient = 0 then // linear
wkColReg = 255 - ((absBidAskDelta / xtremeDelta) * colLimit)

else // useLogColorGradient = 1 // exponential
wkColReg = 255 - (.2 * (Power(1.7 , (7.8 * ((absBidAskDelta / xtremeDelta) - .6)))) * colLimit);

//end; // useLogColorGradient = 0 1

if BidAskDelta >= 0 then begin // Green
Text_SetColor(Value99, RGB(wkColReg * .88, 255, wkColReg * .75));
// * . __ experimenting greens seemed more washed out than reds plus added a little bit of blue .84 .64
// these could be added to input parameters

end
else // BidAskDelta < 0
begin
Text_SetColor(Value99, RGB(255,wkColReg,wkColReg));

end; // BidAskDelta >= 0

end //useThresholds = 0
else
begin // useThresholds = 1 {Legacy method using Thresholds}
if BidAskDelta > Threshold3 then
Text_SetColor(Value99, Green4)
else if BidAskDelta > Threshold2 then
Text_SetColor(Value99, Green3)
else if BidAskDelta > Threshold1 then
Text_SetColor(Value99, Green2)
else if BidAskDelta >= 0 then
Text_SetColor(Value99, Green1)
else if BidAskDelta < -Threshold3 then
Text_SetColor(Value99, Red4)
else if BidAskDelta < -Threshold2 then
Text_SetColor(Value99, Red3)
else if BidAskDelta < -Threshold1 then
Text_SetColor(Value99, Red2)
else
Text_SetColor(Value99, Red1);

end; // useThresholds =

xDelta = xDelta + BidAskDelta;

Price = Price + TickSize;

end; // while Price <= High

if DisplayDelta = true then
begin
Value99 = Text_New(Date, Time, 0, " ");
Text_SetString(Value99, NumToStr(xDelta, 0 ));
Text_SetLocation(Value99, Date, Time, Low - TickSize);
Text_SetStyle(Value99, 1, 1);

if xDelta >= 0 then
Text_SetColor(Value99, Green)
else
Text_SetColor(Value99, Red);
end; // if DisplayDelta = true

end; // (Type = 1 or Type = 2) and LastBarOnChart and BarType < 2

Posted: Sat Sep 30, 2006 4:24 pm
by TheRumpledOne
I attached the ELD.

Posted: Sat Sep 30, 2006 6:05 pm
by EchoTrader
Hello Avery,

I wonder if you have overlooked my above posted question or simply have NO answer for me ?

Has anything changed since the last time we spoke? In any rate just say the word and I will never bother you again, I just hate to be ignored by people regardless of their special ability like yourself.

Best Regards,
TOny

Posted: Sat Sep 30, 2006 6:23 pm
by TheRumpledOne
Tony, I sent you a PM.

Posted: Tue Oct 03, 2006 1:10 pm
by poster
Sorry to ask the knucklehead newbie question -- but you day "eld attached" in the first post of this thread. Where is the eld attached? I'm not finding a link anywhere. Thanks.

Posted: Tue Oct 03, 2006 1:12 pm
by poster
Oh, Lord, nevermind. Found it. Thanks....

Posted: Tue Oct 03, 2006 2:17 pm
by TheRumpledOne
I removed last from the indicator and replaced it with TREND.

TREND indicates how many bars the instruments has been going up/down.



ELD attached.