indiTraders - Forum for the Active Indian Trader  

Go Back   indiTraders - Forum for the Active Indian Trader > Tools > Software > MetaTrader

Reply
 
Bookmark and Share LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-01-2016, 10:32 PM
mukunthank mukunthank is offline
Newbie
 
Join Date: Jan 2016
Posts: 1
Thanks: 0
Thanked 1 Time in 1 Post
mukunthank is on a distinguished road
Lightbulb Gann Sq. of Nine Oscillator Request

Good Day All AFL Masters,

A powerful gann sq. of nine oscillator meta trader format is attached. Can any one please convert into afl code.

This code based on Mithula's overextented indicator, at this moment i am using with excel sheet format, you can use this even 5min timeframe. You can find quick trend movements easily.

Thanking you in advance.

//+------------------------------------------------------------------+
//| Gann Square of 9 Oscillator.mq4 |
//+------------------------------------------------------------------+


#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 LimeGreen
#property indicator_width2 2
#property indicator_width3 2
#property indicator_level1 0

//--- input parameters
extern int PriceMultiplier=10000;
extern int MAPeriod=9;
extern bool ShowMarkers = true;

//--- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double buffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(4);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,234);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexEmptyValue(1,0.0);
SetIndexStyle(2,DRAW_ARROW);
SetIndexArrow(2,233);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexEmptyValue(2,0.0);
SetIndexBuffer(3,buffer);
SetIndexEmptyValue(3,0.0);
//----
return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars = IndicatorCounted();
int limit = Bars - counted_bars;
double dMA;
double step1, step2, step3, step4, step5, step6, step7;
//----

for(int i = limit - 1; i >= 0; i--)
{
step1 = iMA(Symbol(), 0, MAPeriod, 0, MODE_SMA, PRICE_CLOSE, i);
step2 = PriceMultiplier*Close[i];
step3 = step1*PriceMultiplier;
step4 = MathSqrt(step2);
step5 = MathSqrt(step3);
step6 = step4 - step5;
step7 = (step6*360)/2;
buffer[i] = step7;
ExtMapBuffer1[i] = (buffer[i] + buffer[i+1])/2;

if(ShowMarkers)
{
if(ExtMapBuffer1[i] > -120 && ExtMapBuffer1[i+1] <= -120)
{
ExtMapBuffer3[i] = ExtMapBuffer1[i] - 10;
}
if(ExtMapBuffer1[i] > -90 && ExtMapBuffer1[i+1] <= -90)
{
ExtMapBuffer3[i] = ExtMapBuffer1[i] - 10;
}
if(ExtMapBuffer1[i] > -60 && ExtMapBuffer1[i+1] <= -60)
{
ExtMapBuffer3[i] = ExtMapBuffer1[i] - 10;
}
if(ExtMapBuffer1[i] > -30 && ExtMapBuffer1[i+1] <= -30)
{
ExtMapBuffer3[i] = ExtMapBuffer1[i] - 10;
}
if(ExtMapBuffer1[i] > 0 && ExtMapBuffer1[i+1] <= 0)
{
ExtMapBuffer3[i] = ExtMapBuffer1[i] - 10;
}
if(ExtMapBuffer1[i] < 0 && ExtMapBuffer1[i+1] >= 0)
{
ExtMapBuffer2[i] = ExtMapBuffer1[i] + 10;
}
if(ExtMapBuffer1[i] < 30 && ExtMapBuffer1[i+1] >= 30)
{
ExtMapBuffer2[i] = ExtMapBuffer1[i] + 10;
}
if(ExtMapBuffer1[i] < 60 && ExtMapBuffer1[i+1] >= 60)
{
ExtMapBuffer2[i] = ExtMapBuffer1[i] + 10;
}
if(ExtMapBuffer1[i] < 90 && ExtMapBuffer1[i+1] >= 90)
{
ExtMapBuffer2[i] = ExtMapBuffer1[i] + 10;
}
if(ExtMapBuffer1[i] < 120 && ExtMapBuffer1[i+1] >= 120)
{
ExtMapBuffer2[i] = ExtMapBuffer1[i] + 10;
}
}

}

//----
return(0);
}
//+------------------------------------------------------------------+
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to mukunthank For This Useful Post:
Reply

indiTraders - Forum for the Active Indian Trader > Tools > Software > MetaTrader


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT +5.5. The time now is 03:38 PM.


vBulletin Copyright by vBulletin

Content Relevant URLs by vBSEO 3.3.2