TradingView
zamansiz74
31 Ağu 2023 21:07

[sphx] FWMA 

Apple Inc.NASDAQ

Açıklama

I've developed a cool indicator. The indicator calculates a Fibonacci-weighted moving average (FWMA) based on a specific length. What sets it apart is that it assists me in identifying potential trend reversals. When the indicator's color changes - from red to light red or from green to light green - it's an indication that the trend might be shifting.

What makes the indicator even more interesting: While I'm keeping an eye on these color changes, I'm also observing the price behavior. I check whether the price is in a consolidation phase during the color transition. This not only helps me detect potential trend changes but also to see whether the market is in a phase of price consolidation. The combination of this information aids me in making well-informed trading decisions.

I find the indicator so useful that I've decided to make it available to the community. You can use the code and adapt it to your own trading strategies. I hope it's as helpful to you as it has been to me. Wishing all of you successful trades and the best outcomes! Let's understand the market together and trade successfully.
Yorumlar
CaptainNORDO
This is just an awesome indicator. Thanks for sharing it!
zamansiz74
@CaptainNORDO, You're very welcome! I'm glad you like the indicator. Wishing you successful trades and, most importantly, good health so you can enjoy the earned money! :)
RayBan201
@zamansiz74, Is there any way you can make one for long term trade like say years in one ticker?
zamansiz74
@RayBan201, I apply the script in the daily chart and simultaneously assess in the weekly or monthly chart whether the trend is developing in the direction I want to invest. If there are sufficient historical data, I recommend adjusting the time frame on TradingView – ranging from one day to two days, one week, one month, or even one year. Have I correctly interpreted your intention?
Ligaz
Hell can I get Can I get MT4 version of this indicator? [sphx] FWMA
zamansiz74
@Ligaz, The programming language in Meta4 is different and does not have some features.
I don't have MT4 myself, but you can try to get the code below to work.
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_width1 1
#property indicator_width2 1

// Fibonacci-Zahlenreihe
int fibonacciNumbers[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(0, fibonacciAvgValueBuffer);
SetIndexStyle(1, DRAW_LINE);
SetIndexBuffer(1, fibonacciAvgValue2Buffer);

// Erste beiden Fibonacci-Zahlen
fibonacciNumbers[0] = 1;
fibonacciNumbers[1] = 2;

return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
int limit = rates_total - prev_calculated;
if(prev_calculated > rates_total || prev_calculated < 0)
{
Print("Invalid previous calculation");
return(-1);
}

for(int i = 2; i < rates_total; i++)
{
fibonacciNumbers = fibonacciNumbers[i - 1] + fibonacciNumbers[i - 2];
}

for(int i = 0; i < limit; i++)
{
double sum = 0.0;
double weightSum = 0.0;
for(int j = 0; j < periods; j++)
{
double fibNumber = fibonacciNumbers[j];
sum += close[fibNumber - 1];
}

fibonacciAvgValueBuffer = sum / periods;
}

for(int i = 0; i < limit; i++)
{
double sum = 0.0;
double weightSum = 0.0;
for(int j = 0; j < periods2; j++)
{
double fibNumber = fibonacciNumbers[j];
sum += close[fibNumber - 1];
}

fibonacciAvgValue2Buffer = sum / periods2;
}

return(rates_total);
}
//+------------------------------------------------------------------+
Daha Fazla