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)
1st one is indicator code, 2nd one is for _anaMovingMedian function used by the indicator.
All you need is copy and paste the code in EasyLanguage Editor (File -> New).
Changwin,
I import, compile code and indic .. but one problem ..
I have make :subgraph1 ...same as instrument but just one red line at 0.001
Have you one idea why?
Thank you
hello, getting an error that fill_array is not defined in the function. Thanks
{ OnStartUp }
if initialized = false then begin
initialized = true;
array_setmaxindex(mArray, Period);
fill_array(mArray, 0.0);
if mod(Period, 2) = 0 then begin
even = true;
TS file attached. Some minor changes to MC code below.
inputs:
PriceValue(NumericSeries),
Period(NumericSimple);
variables:
medianIndex(0),
priorIndex(0),
even(true),
sPeriod(0),
idx(0),
val(0),
initialized(false);
array:
mArray[](0);
{ OnStartUp }
if initialized = false then begin
initialized = true;
array_setmaxindex(mArray, Period);
fill_array(mArray, 0.0);
if mod(Period, 2) = 0 then begin
even = true;
medianIndex = floor(Period/2);
priorIndex = medianIndex - 1;
end
else begin
even = false;
medianIndex = floor((Period - 1)/2);
end;
end;
{ OnUpdate }
if currentbar <= Period then begin
sPeriod = currentbar;
for idx = 1 to sPeriod begin
mArray[idx] = PriceValue[idx-1];
end;
array_sort(mArray, 1, sPeriod, true);
if mod(sPeriod, 2) <> 0 then begin
idx = floor(sPeriod/2);
val = 0.5 * (mArray[Period - idx] + mArray[Period - idx + 1]);
end
else begin
idx = sPeriod/2;
val = mArray[Period - idx];
end;
end
else begin
for idx = 1 to Period begin
mArray[idx] = PriceValue[idx-1];
end;
array_sort(mArray, 1, Period, true);
if even then
val = 0.5 * (mArray[medianIndex] + mArray[priorIndex])
else
val = mArray[medianIndex];
end;
_anaMovingMedian = val;
Elite Membership required to download: ANASUPERTREND.ELD
While one will go broke taking every signal, I find the various forms of superTrend are great as a trend 'filter'. Can be easily used in strategies.
So once Trend is identified, take signals(some other method) in the direction of SuperTrend.
A slight modification to the anaSuperTrend code. The following will generate just one line and switch colors.
{if currentUpTrend = true then begin
plot1(stopDot, "UpStopDot");
end;
if currentUpTrend = false then begin
plot2(stopDot, "DnStopDot");
end;}
Plot1(stopDot);
If close > stopDot Then
SetPlotColor(1,Green)else
SetPlotColor(1,magenta);