Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Fear/Greed Indicator
Updated January 17, 2013
Top Posters
looks_one
Fat Tails
with 5 posts (16 thanks)
looks_two
PegasusDK
with 5 posts (10 thanks)
looks_3
Mehul
with 4 posts (0 thanks)
looks_4
cory
with 3 posts (9 thanks)
Best Posters
looks_one
Fat Tails
with 3.2 thanks per post
looks_two
cory
with 3 thanks per post
looks_3
PegasusDK
with 2 thanks per post
looks_4
Loukas
with 0.3 thanks per post
trending_up
28,242 views
thumb_up
36 thanks given
group
18 followers
forum
31 posts
attach_file
9 attachments
Fear/Greed Indicator
November 15th, 2011, 12:15 PM
Berlin, Europe
Market Wizard
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103
Mehul
Hi fat tails
How Ve you been doing with your fear and greed, any more progress?
Thanks
Mehul
I have been completely absorbed by other projects and forgotten my fear and greed.
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
November 16th, 2011, 05:13 AM
Odense, Denmark
Posts: 5 since Oct 2011
Thanks Given: 1
Thanks Received: 10
Hi Mehul & others,
I'd love to provide you with a sample spread sheet!
I'm pretty much hung up at the moment, but I will most certainly post an example in the near future.
Stay tuned...
/PegasusDK
November 16th, 2011, 10:11 AM
London, united kingdom
Posts: 27 since Nov 2011
Thanks Given: 2
Thanks Received: 3
Hi
Thanks for the reply , look forward to the excel example.
What products do you trade !
Regards
Mehul
PegasusDK
Hi Mehul & others,
I'd love to provide you with a sample spread sheet!
I'm pretty much hung up at the moment, but I will most certainly post an example in the near future.
Stay tuned...
/PegasusDK
November 27th, 2011, 04:31 PM
Odense, Denmark
Posts: 5 since Oct 2011
Thanks Given: 1
Thanks Received: 10
I've promised a sample spread sheet with the fear/greed and the Trender, but this one will be delayed due to my other activities the next month or so.
I've then decided to put my code to Vikingen here, as it's much easier for me.
If you have any questions about the code, please put them here.
Here goes...
Code
par(Main : Instrument;
MidPointEMAlen : Integer; // Parameters for Trender
TrueRangeEMAlen : Integer;
StdDevPeriod : Integer;
StdDevFactor : Real;
UseClose : Boolean;
W1orE2 : Integer; // Parameters for FearGreed
FastMA : Integer;
SlowMA : Integer;
ShiftBack : Integer; // Also used for the TrueRange over "ShiftBack" periods
SmoothMA : Integer;
BuyLevel,
SellLevel : Real;
Out TrenderRes,
TrenderSup : RealVector;
Out FearGreed : RealVector;
Out LinZero,
LinBuy,
LinSell : RealVector;
Out ChangePct : RealVector;
Out BuyAge,
SellAge : RealVector;
Out Buy, Sell : BooleanVector);
var i,
Lengde,
StartPos,
TotPeriod : Integer;
Support : Boolean;
r1, r2,
r3, r4 : RealVector;
StdDevTrueRange : RealVector;
MidPoint,
AdjMidPoint : RealVector;
Trender,
HiPrice,
LoPrice,
ClsPrice,
HiPricePeriod,
LoPricePeriod : RealVector;
ZeroVector,
UnDefVector : RealVector;
TrueRange,
TrueRangeUp,
TrueRangeEMA,
TrueRangeDwn : RealVector;
TRfastUp,
TRfastDwn,
TRslowUp,
TRslowDwn : RealVector;
FGraw,
FastDiff,
SlowDiff : RealVector;
b1, s1,
b2, s2 : BooleanVector;
BEGIN
LinZero := 0;
ZeroVector := 0;
StartPos := 14;
HiPrice := FILL(Main.High);
LoPrice := FILL(Main.Low);
ClsPrice := FILL(Main.Close);
Lengde := LEN(ClsPrice) - 1;
// Calculate True Range
R1 := HiPrice - LoPrice;
R2 := ABS(LoPrice - Shift(ClsPrice, 1));
R3 := ABS(HiPrice - Shift(ClsPrice, 1));
R4 := ALT((R1 > R2), R1, R2);
TrueRange := ALT((R3 > R4), R3, R4);
TrueRangeEMA := MAVX(TrueRange, TrueRangeEMAlen);
StdDevTrueRange := STDEV(TrueRangeEMA, StdDevPeriod);
MidPoint := (LoPrice + HiPrice) / 2;
AdjMidPoint := MAVX(MidPoint, MidPointEMAlen) + (TrueRangeEMA / 2);
AdjMidPoint := AdjMidPoint + (StdDevTrueRange * StdDevFactor);
// Calculate support and resistance lines for the Trender
//---------------------------------------------------------
TrenderRes := AdjMidPoint;
TrenderSup := MAVX(MidPoint, MidPointEMAlen) - (TrueRangeEMA / 2);
TrenderSup := TrenderSup - (StdDevTrueRange * StdDevFactor);
// Find initial direction = the active Trender
Support := (ClsPrice[StartPos] > TrenderRes[StartPos]);
i := StartPos;
Loop;
i := i + 1;
if (i > Lengde) then Exit; end;
if Support then
if (TrenderSup[i-1] > TrenderSup[i]) then
TrenderSup[i] := TrenderSup[i-1];
end;
if (ClsPrice[i] < TrenderSup[i]) then
// Make TrenderRes the new Trender => go from buy to sell
s1[i] := TRUE;
Support := FALSE;
Trender[i] := TrenderRes[i];
else
b1[i] := TRUE;
Trender[i] := TrenderSup[i];
end;
else
if (TrenderRes[i-1] < TrenderRes[i]) then
TrenderRes[i] := TrenderRes[i-1];
end;
if (ClsPrice[i] > TrenderRes[i]) then
// Make TrenderSup the new Trender => go from sell to buy
b1[i] := TRUE;
Support := TRUE;
Trender[i] := TrenderSup[i];
else
s1[i] := TRUE;
Trender[i] := TrenderRes[i];
end;
end;
end; // Loop...
TrenderRes := ALT((s1 = TRUE), Trender, UnDefVector);
TrenderSup := ALT((b1 = TRUE), Trender, UnDefVector);
// Calculate FearGreed
//---------------------
LoPricePeriod := Std.MIN(LoPrice, ShiftBack);
HiPricePeriod := Std.MAX(HiPrice, ShiftBack);
// Calculate new TrueRange for "ShiftBack" periods
R1 := HiPricePeriod - LoPricePeriod;
R2 := ABS(LoPricePeriod - Shift(ClsPrice, 1));
R3 := ABS(HiPricePeriod - Shift(ClsPrice, 1));
R4 := ALT((R1 > R2), R1, R2);
TrueRange := ALT((R3 > R4), R3, R4);
TrueRangeUp := ALT((ClsPrice > SHIFT(ClsPrice, ShiftBack)), TrueRange, ZeroVector);
TrueRangeDwn := ALT((ClsPrice < SHIFT(ClsPrice, ShiftBack)), TrueRange, ZeroVector);
if (W1orE2 = 1) then
TRfastUp := MAVW(TrueRangeUp, FastMA);
TRfastDwn := MAVW(TrueRangeDwn, FastMA);
TRslowUp := MAVW(TrueRangeUp, SlowMA);
TRslowDwn := MAVW(TrueRangeDwn, SlowMA);
else
TRfastUp := MAVX(TrueRangeUp, FastMA);
TRfastDwn := MAVX(TrueRangeDwn, FastMA);
TRslowUp := MAVX(TrueRangeUp, SlowMA);
TRslowDwn := MAVX(TrueRangeDwn, SlowMA);
end;
FastDiff := (TRfastUp - TRfastDwn);
SlowDiff := (TRslowUp - TRslowDwn);
FGraw := (FastDiff - SHIFT(SlowDiff, ShiftBack));
if (W1orE2 = 1) then
FearGreed := MAVW(FGraw, SmoothMA);
else
FearGreed := MAVX(FGraw, SmoothMA);
end;
TotPeriod := LEN(FearGreed) - 1;
// Depending on the current time period (M, W or D), the corresponding period for MIN and MAX is set.
if TimeUnit(TimeVec) = 2 then
i := 822;
else
if TimeUnit(TimeVec) = 3 then
i := 182;
else
i := 42;
end;
end;
if i > TotPeriod then
i := TotPeriod - 5;
end;
R1 := Std.MAX(FearGreed, i);
R4 := Std.MIN(FearGreed, i);
LinBuy := (R1[TotPeriod] * BuyLevel) / 100;
LinSell := (R4[TotPeriod] * SellLevel) / 100;
b2 := (b1 = TRUE);
s2 := (s1 = TRUE);
Buy := FilterBuy(b2, s2);
Sell := FilterSell(b2, s2);
i := std.GetBuySellAge(Buy, Sell, BuyAge, SellAge);
ChangePct := DiffFromSignal(Buy OR Sell, ClsPrice);
END;
EDIT(added): Mehul & others, sorry I haven't answered your PM's, but I need at least 5 post to do so, and I don't want to spam this forum with unimportant posts, just to be allowed to answer a PM.
November 30th, 2011, 04:50 PM
Odense, Denmark
Posts: 5 since Oct 2011
Thanks Given: 1
Thanks Received: 10
Hi all,
Well, it went a bit faster than I expected ;-)
It was pretty tricky to convert the code to Excel, but it should work now.
The Excel sheet is zipped, no password, no macros.
It was written in the danish version of Excel 2007. I guess it will convert automatically to the target language...
Best regards to you all!
Attached Files
Elite Membership required to download: FearGreedTrender_BMT.zip
December 12th, 2011, 11:02 PM
London, united kingdom
Posts: 27 since Nov 2011
Thanks Given: 2
Thanks Received: 3
great work ... i will see how it works with my data and let you know....
March 15th, 2012, 01:22 PM
Sao Paulo/Brasil
Posts: 1 since Mar 2012
Thanks Given: 0
Thanks Received: 0
PegasusDK
Hi Fat Tails,
I am very interested in getting more details about your progress with this Fear/Greed "twin".
I've been working on re-engineering both the Bloomberg Trender and the Fear/Greed-indicator for a while, so far with succes as for the Trender overlay, but I get stuck calculating the F/G.
I would be very happy if you could elaborate your work so far...
Regarding the Trender, I would be glad to provide the code and/or method.
I'm not an NT programmer (I code solely in Vikingen, a Scandinavian TA software package), so please advise me where to put it (forum/thread), if you want it.
Best regards
PegasusDK
Hi Pegasus, i would like to take a look at the bbg trender method pls.
October 15th, 2012, 12:05 PM
Concord, CA
Experience: Intermediate
Platform: Sierra Charts and NT7
Broker: AMP/CQG
Trading: Mini's and CL
Posts: 230 since Oct 2009
Thanks Given: 975
Thanks Received: 276
Hi Fat Tails, could you please post the code for this.....I am not a coder so it would be great if you could post this ....please
Fat Tails
Just had a look at the picture. I love that type of challenge. Rebuilding an indicator without knowing the formula. This is the approach I followed:
-> calculated two
range series from the
average true range , one from upcloses, the other one from down closes
-> used a fast period to calculate a weighted
moving average from both series
-> use a slow period to calculate a weighted moving average from both series, but shift them first by n bars
-> then calculate a MACD type indicator from the four weighted moving averages
The result is an indicator, which is similar to Bloomberg's Fear Greed Oscillator, but not identical. Personally I feel that it looks better than the Bloomberg indicator, so I am happy that I have not created any copy. This is still work in progress, so I do not post it here. Might create an elite thread later.
Applied it to AAPL just to compare it with the other
screenshot .
January 11th, 2013, 12:28 PM
Scottsdale
Posts: 120 since Feb 2012
Thanks Given: 33
Thanks Received: 96
PegasusDK
I've promised a sample spread sheet with the fear/greed and the Trender, but this one will be delayed due to my other activities the next month or so.
I've then decided to put my code to Vikingen here, as it's much easier for me.
If you have any questions about the code, please put them here.
Here goes...
Code
par(Main : Instrument;
MidPointEMAlen : Integer; // Parameters for Trender
TrueRangeEMAlen : Integer;
StdDevPeriod : Integer;
StdDevFactor : Real;
UseClose : Boolean;
W1orE2 : Integer; // Parameters for FearGreed
FastMA : Integer;
SlowMA : Integer;
ShiftBack : Integer; // Also used for the TrueRange over "ShiftBack" periods
SmoothMA : Integer;
BuyLevel,
SellLevel : Real;
Out TrenderRes,
TrenderSup : RealVector;
Out FearGreed : RealVector;
Out LinZero,
LinBuy,
LinSell : RealVector;
Out ChangePct : RealVector;
Out BuyAge,
SellAge : RealVector;
Out Buy, Sell : BooleanVector);
var i,
Lengde,
StartPos,
TotPeriod : Integer;
Support : Boolean;
r1, r2,
r3, r4 : RealVector;
StdDevTrueRange : RealVector;
MidPoint,
AdjMidPoint : RealVector;
Trender,
HiPrice,
LoPrice,
ClsPrice,
HiPricePeriod,
LoPricePeriod : RealVector;
ZeroVector,
UnDefVector : RealVector;
TrueRange,
TrueRangeUp,
TrueRangeEMA,
TrueRangeDwn : RealVector;
TRfastUp,
TRfastDwn,
TRslowUp,
TRslowDwn : RealVector;
FGraw,
FastDiff,
SlowDiff : RealVector;
b1, s1,
b2, s2 : BooleanVector;
BEGIN
LinZero := 0;
ZeroVector := 0;
StartPos := 14;
HiPrice := FILL(Main.High);
LoPrice := FILL(Main.Low);
ClsPrice := FILL(Main.Close);
Lengde := LEN(ClsPrice) - 1;
// Calculate True Range
R1 := HiPrice - LoPrice;
R2 := ABS(LoPrice - Shift(ClsPrice, 1));
R3 := ABS(HiPrice - Shift(ClsPrice, 1));
R4 := ALT((R1 > R2), R1, R2);
TrueRange := ALT((R3 > R4), R3, R4);
TrueRangeEMA := MAVX(TrueRange, TrueRangeEMAlen);
StdDevTrueRange := STDEV(TrueRangeEMA, StdDevPeriod);
MidPoint := (LoPrice + HiPrice) / 2;
AdjMidPoint := MAVX(MidPoint, MidPointEMAlen) + (TrueRangeEMA / 2);
AdjMidPoint := AdjMidPoint + (StdDevTrueRange * StdDevFactor);
// Calculate support and resistance lines for the Trender
//---------------------------------------------------------
TrenderRes := AdjMidPoint;
TrenderSup := MAVX(MidPoint, MidPointEMAlen) - (TrueRangeEMA / 2);
TrenderSup := TrenderSup - (StdDevTrueRange * StdDevFactor);
// Find initial direction = the active Trender
Support := (ClsPrice[StartPos] > TrenderRes[StartPos]);
i := StartPos;
Loop;
i := i + 1;
if (i > Lengde) then Exit; end;
if Support then
if (TrenderSup[i-1] > TrenderSup[i]) then
TrenderSup[i] := TrenderSup[i-1];
end;
if (ClsPrice[i] < TrenderSup[i]) then
// Make TrenderRes the new Trender => go from buy to sell
s1[i] := TRUE;
Support := FALSE;
Trender[i] := TrenderRes[i];
else
b1[i] := TRUE;
Trender[i] := TrenderSup[i];
end;
else
if (TrenderRes[i-1] < TrenderRes[i]) then
TrenderRes[i] := TrenderRes[i-1];
end;
if (ClsPrice[i] > TrenderRes[i]) then
// Make TrenderSup the new Trender => go from sell to buy
b1[i] := TRUE;
Support := TRUE;
Trender[i] := TrenderSup[i];
else
s1[i] := TRUE;
Trender[i] := TrenderRes[i];
end;
end;
end; // Loop...
TrenderRes := ALT((s1 = TRUE), Trender, UnDefVector);
TrenderSup := ALT((b1 = TRUE), Trender, UnDefVector);
// Calculate FearGreed
//---------------------
LoPricePeriod := Std.MIN(LoPrice, ShiftBack);
HiPricePeriod := Std.MAX(HiPrice, ShiftBack);
// Calculate new TrueRange for "ShiftBack" periods
R1 := HiPricePeriod - LoPricePeriod;
R2 := ABS(LoPricePeriod - Shift(ClsPrice, 1));
R3 := ABS(HiPricePeriod - Shift(ClsPrice, 1));
R4 := ALT((R1 > R2), R1, R2);
TrueRange := ALT((R3 > R4), R3, R4);
TrueRangeUp := ALT((ClsPrice > SHIFT(ClsPrice, ShiftBack)), TrueRange, ZeroVector);
TrueRangeDwn := ALT((ClsPrice < SHIFT(ClsPrice, ShiftBack)), TrueRange, ZeroVector);
if (W1orE2 = 1) then
TRfastUp := MAVW(TrueRangeUp, FastMA);
TRfastDwn := MAVW(TrueRangeDwn, FastMA);
TRslowUp := MAVW(TrueRangeUp, SlowMA);
TRslowDwn := MAVW(TrueRangeDwn, SlowMA);
else
TRfastUp := MAVX(TrueRangeUp, FastMA);
TRfastDwn := MAVX(TrueRangeDwn, FastMA);
TRslowUp := MAVX(TrueRangeUp, SlowMA);
TRslowDwn := MAVX(TrueRangeDwn, SlowMA);
end;
FastDiff := (TRfastUp - TRfastDwn);
SlowDiff := (TRslowUp - TRslowDwn);
FGraw := (FastDiff - SHIFT(SlowDiff, ShiftBack));
if (W1orE2 = 1) then
FearGreed := MAVW(FGraw, SmoothMA);
else
FearGreed := MAVX(FGraw, SmoothMA);
end;
TotPeriod := LEN(FearGreed) - 1;
// Depending on the current time period (M, W or D), the corresponding period for MIN and MAX is set.
if TimeUnit(TimeVec) = 2 then
i := 822;
else
if TimeUnit(TimeVec) = 3 then
i := 182;
else
i := 42;
end;
end;
if i > TotPeriod then
i := TotPeriod - 5;
end;
R1 := Std.MAX(FearGreed, i);
R4 := Std.MIN(FearGreed, i);
LinBuy := (R1[TotPeriod] * BuyLevel) / 100;
LinSell := (R4[TotPeriod] * SellLevel) / 100;
b2 := (b1 = TRUE);
s2 := (s1 = TRUE);
Buy := FilterBuy(b2, s2);
Sell := FilterSell(b2, s2);
i := std.GetBuySellAge(Buy, Sell, BuyAge, SellAge);
ChangePct := DiffFromSignal(Buy OR Sell, ClsPrice);
END;
EDIT(added): Mehul & others, sorry I haven't answered your PM's, but I need at least 5 post to do so, and I don't want to spam this forum with unimportant posts, just to be allowed to answer a PM.
Anyone now how to convert this to Tradestation easy language?
January 11th, 2013, 06:06 PM
GER
Experience: Advanced
Platform: MC
Trading: ES
Posts: 144 since May 2011
Thanks Given: 11
Thanks Received: 213
Last Updated on January 16, 2013