logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
nolube  
#1 Posted : Tuesday, November 12, 2013 3:21:21 PM(UTC)
nolube

Rank: Newbie

Groups: Registered, Registered Users
Joined: 11/12/2013(UTC)
Posts: 1

Hi guys, what great forum. My coding knowledge is zero but I have a very interesting indicator from MT4 which I'd like to throw on some stock charts. I'm hoping someone here could code it in MS for me, and I'm also hoping others here find it useful!

It's called 'Volatility Pivot' and I believe it works around ATR but I'm not of the specifics.

If someone could have a look at it for me that would be superb. Have a great day!

Pasted below is the Volatility Pivot indicator code for MT4.

Regards

-------------------------------------------------------------------------------------------------------------

//+------------------------------------------------------------------+
//| Volatility.Pivot.mq4 |
//+------------------------------------------------------------------+
#property copyright "thanks to S.B.T. (Japan)"
#property link "http://sufx.core.t3-ism.net/" //<<< convert this from VT, thanks mate !!!
//----
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
//---- input parameters
extern double atr_range=100;
extern double ima_range=10;
extern double atr_factor=3;
extern int Mode=0;
extern double DeltaPrice=30;
//---- buffers
double TrStop[];
double ATR[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0, DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(0, TrStop);
SetIndexStyle(1, DRAW_NONE);
SetIndexBuffer(1, ATR);
//----
string short_name="!! RisenbergVolatilityCapture";
IndicatorShortName(short_name);
SetIndexLabel(1,"range base");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int limit;
int i;
//----
double DeltaStop;
//----
limit=Bars;
for(i=0; i < limit; i ++)
{
ATR=iATR(NULL,0,atr_range,i);
}
for(i=limit - 1; i>=0; i --)
{
if (Mode==0)
{
DeltaStop=iMAOnArray(ATR,0,ima_range,0,MODE_EMA,i) * atr_factor;
//DeltaStop = iATR(NULL,0,atr_range,i) * atr_factor;
}
else
{
DeltaStop=DeltaPrice*Point;
}
if (Close==TrStop[i + 1])
{
TrStop=TrStop[i + 1];
}
else
{
if (Close[i+1]<TrStop[i+1] && Close<TrStop[i+1])
{
TrStop=MathMin(TrStop[i + 1], Close + DeltaStop);
}
else
{
if (Close[i+1]>TrStop[i+1] && Close>TrStop[i+1])
{
TrStop=MathMax(TrStop[i+1], Close - DeltaStop);
}
else
{
if (Close > TrStop[i+1]) TrStop=Close - DeltaStop; else TrStop=Close + DeltaStop;
}
}
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.