I need to Convert the super trend Indicator.

Indicators coded by community members
Message
Author
Bend
Posts: 9
Joined: Wed Feb 19, 2014 3:02 pm

I need to Convert the super trend Indicator.

#1 Postby Bend » Tue Oct 14, 2014 2:45 am

I I would like to convert the Super trend indicator. Any quotes.
Attachments
xSuperTrend nmc.rar
(1.18 KiB) Downloaded 442 times

Bend
Posts: 9
Joined: Wed Feb 19, 2014 3:02 pm

Re: I need to Convert the super trend Indicator.

#2 Postby Bend » Tue Oct 14, 2014 7:00 am

I tried this morning to make it on my own, but I am lost at the calculation of the indicator. Specifically this what I have done
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
library SuperTrend;

uses
graphics, windows, IndicatorInterfaceUnit, math;
var
// External variables
SuperTrend_Period: integer;
SuperTrend_Multiplier: double;

// Buffers
gadUpBuf, SgadDnBuf, gadSuperTrend: TIndexBuffer;

//---------------------------------------------------------------------------
// Initialize indicator
//---------------------------------------------------------------------------
procedure Init; stdcall;
begin
// define properties
IndicatorShortName('SuperTrend');
SetOutputWindow(ow_ChartWindow);
// register options
AddSeparator('Common');

RegOption('Period', ot_Integer, SuperTrend_Period);
SetOptionRange('Period', 1, MaxInt);
SuperTrend_Period := 10;

RegOption('Multiplier', ot_Double, SuperTrend_Multiplier);
SetOptionRange('Multiplier', 0.1, 200);
SuperTrend_Multiplier := 1.7;

// create buffers
gadUpBuf := CreateIndexBuffer;
SgadDnBuf := CreateIndexBuffer;
gadSuperTrend := CreateIndexBuffer;

IndicatorBuffers(3);
SetIndexBuffer(0, gadUpBuf);
SetIndexBuffer(1, SgadDnBuf);
SetIndexBuffer(2, gadSuperTrend);
SetIndexStyle(0, ds_Line, psSolid, 1, clGreen);
SetIndexLabel(0, 'SuperTrend Up');
SetIndexStyle(1, ds_Line, psSolid, 1, clRed);
SetIndexLabel(1, 'SuperTrend Down');
SetIndexStyle(3, ds_Line, psSolid, 1, clYellow);
SetIndexLabel(3, 'SuperTrend');
end;
//---------------------------------------------------------------------------
// Deinitialize indicator
//---------------------------------------------------------------------------
procedure Done; stdcall;
begin

end;


end;
begin
end.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""


And I need to plug the following code:
"""""""""""""""""""""""""""""""""""""""""""""""
///-----------------------------------------------------------------------------
// function: start()
// Description: Custom indicator iteration function.
//-----------------------------------------------------------------------------
int start() {
int iNewBars, iCountedBars, i;
double dAtr,dUpperLevel, dLowerLevel;

// Get unprocessed ticks
iCountedBars=IndicatorCounted();
if(iCountedBars < 0) return (-1);
if(iCountedBars>0) iCountedBars--;
iNewBars=Bars-iCountedBars;

for(i=iNewBars; i>=0; i--) {
// Calc SuperTrend
dAtr = iATR(NULL, 0, SuperTrend_Period, i);
dUpperLevel=(High[i]+Low[i])/2+SuperTrend_Multiplier*dAtr;
dLowerLevel=(High[i]+Low[i])/2-SuperTrend_Multiplier*dAtr;

// Set supertrend levels
if (Close[i]>gadSuperTrend[i+1] && Close[i+1]<=gadSuperTrend[i+1]) {
gadSuperTrend[i]=dLowerLevel;
}
else if (Close[i]<gadSuperTrend[i+1] && Close[i+1]>=gadSuperTrend[i+1]) {
gadSuperTrend[i]=dUpperLevel;
}
else if (gadSuperTrend[i+1]<dLowerLevel)
gadSuperTrend[i]=dLowerLevel;
else if (gadSuperTrend[i+1]>dUpperLevel)
gadSuperTrend[i]=dUpperLevel;
else
gadSuperTrend[i]=gadSuperTrend[i+1];

// Draw SuperTrend lines
gadUpBuf[i]=EMPTY_VALUE;
gadDnBuf[i]=EMPTY_VALUE;
if (Close[i]>gadSuperTrend[i] || (Close[i]==gadSuperTrend[i] && Close[i+1]>gadSuperTrend[i+1]))
gadUpBuf[i]=gadSuperTrend[i];
else if (Close[i]<gadSuperTrend[i] || (Close[i]==gadSuperTrend[i] && Close[i+1]<gadSuperTrend[i+1]))
gadDnBuf[i]=gadSuperTrend[i];
}

return(0);
}
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

Any Help??????

mopaditi
Posts: 1
Joined: Sat Sep 26, 2015 7:47 am

Re: I need to Convert the super trend Indicator.

#3 Postby mopaditi » Sat Sep 26, 2015 8:33 pm

Did you get this Super Trend converted? I use this indicator as well.

Stonev
Posts: 204
Joined: Thu Jan 28, 2010 2:20 pm

Re: I need to Convert the super trend Indicator.

#4 Postby Stonev » Sat Sep 26, 2015 10:56 pm

I can convert this indicator (or any other) for some fee.

Stonev@yandex.ru
Alexey
Coding & Converting


Return to “Indicators”

Who is online

Users browsing this forum: No registered users and 4 guests