Price Data Components
0
Views
0
Downloads
0
Favorites
All_QQE v1.0
//+------------------------------------------------------------------+
//| All Stochastic.mq4 |
//| Modified by GodfreyH for QQE|
//| Modified by Obaidah for Gann|
//| made by : mladen |
//+------------------------------------------------------------------+
#property copyright "this is public domain software"
#property link "www.forex-tsd.com"
#define indicatorName "Trend Map"
//
//
//
//
//
#property indicator_separate_window
#property indicator_buffers 2
//#property indicator_maximum 70
//#property indicator_minimum 30
#property indicator_color1 White
#property indicator_style1 STYLE_SOLID
#property indicator_width1 2
#property indicator_color2 White
#property indicator_style2 STYLE_DOT
#property indicator_level1 50
#property indicator_level2 70
#property indicator_level3 30
#property indicator_levelstyle STYLE_SOLID
#property indicator_levelcolor Blue
//---- input parameters
//
//
//
//
//
extern string aa="Gann Parameter";
extern int Lb=10;
extern string bb="QEE Paramters";
extern int SF = 5; // original 5
extern int RSI_Period = 14; // original 14
extern double DARFACTOR = 4.236; //original 4.236
extern string __ = "Chose timeframes (as in periodicity bar)";
extern string timeFrames = "M15;H1;H4;D1";
extern int barsPerTimeFrame = 25;
extern int ShadowBarsPerTimeFrame=25;
extern bool shiftRight = False;
extern bool currentFirst = False;
extern color txtColor = White;
extern color separatorColor = Yellow;
extern string shadows="Gann + QQE trend shadow colors";
extern color BULLISH=Green;
extern color BEARISH=C'157,0,0';
extern color RANGING=-1;
//---- buffers
//
//
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//
//
//
//
//
string shortName;
string labels[];
int periods[];
int Shift;
color shadow;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
if (shiftRight) Shift = 1;
else Shift = 0;
barsPerTimeFrame = MathMax(barsPerTimeFrame,15);
shortName = indicatorName;
IndicatorShortName(shortName);
//
//
//
//
//
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexShift(0,Shift*(barsPerTimeFrame+1));
SetIndexShift(1,Shift*(barsPerTimeFrame+1));
SetIndexLabel(0,"QQEA");
SetIndexLabel(1,"NULL");
//
//
//
//
//
timeFrames = StringUpperCase(StringTrimLeft(StringTrimRight(timeFrames)));
if (StringSubstr(timeFrames,StringLen(timeFrames),1) != ";")
timeFrames = StringConcatenate(timeFrames,";");
//
//
//
//
//
int s = 0;
int i = StringFind(timeFrames,";",s);
string current;
while (i > 0)
{
current = StringSubstr(timeFrames,s,i-s);
int time = stringToTimeFrame(current);
if (time > 0) {
ArrayResize(labels ,ArraySize(labels)+1);
ArrayResize(periods,ArraySize(periods)+1);
labels[ArraySize(labels)-1] = current;
periods[ArraySize(periods)-1] = time; }
s = i + 1;
i = StringFind(timeFrames,";",s);
}
//
//
//
//
//
if(currentFirst)
for (i=1;i<ArraySize(periods);i++)
if (Period()==periods[i])
{
string tmpLbl = labels[i];
int tmpPer = periods[i];
//
//
//
//
//
for (int k=i ;k>0; k--) {
labels[k] = labels[k-1];
periods[k] = periods[k-1];
}
labels[0] = tmpLbl;
periods[0] = tmpPer;
}
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
for(int l=0;l<ArraySize(periods);l++) {
ObjectDelete(indicatorName+l);
ObjectDelete(indicatorName+l+"label");
ObjectDelete(indicatorName+l+"shadow");
}
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
double Gann;
string separator;
int window=WindowFind(shortName);
int k=0;
//
//
//
//
//
double solid, dotted, ClosePrice;
for(int p=0; p<ArraySize(periods);p++)
{
for(int i=0; i<barsPerTimeFrame;i++,k++)
{
ExtMapBuffer1[k] = iCustom(NULL,periods[p],"QQEA",SF,RSI_Period,DARFACTOR,0,i);
ExtMapBuffer2[k] = iCustom(NULL,periods[p],"QQEA",SF,RSI_Period,DARFACTOR,1,i);
}
ExtMapBuffer1[k] =EMPTY_VALUE;
ExtMapBuffer2[k] =EMPTY_VALUE;
k += 1;
//
//
//
//
//
solid=iCustom(Symbol(),periods[p],"QQEA",SF,RSI_Period,DARFACTOR,0,1);
dotted=iCustom(Symbol(),periods[p],"QQEA",SF,RSI_Period,DARFACTOR,1,1);
Gann=iCustom(Symbol(),periods[p],"###Gann_HiLo_Activator_v2###",Lb,0,1);
ClosePrice=iClose(Symbol(),periods[p],1);
shadow=RANGING;
if(solid>dotted && ClosePrice > Gann)
shadow=BULLISH;
else {
if(solid<dotted && ClosePrice < Gann)
shadow=BEARISH;
}
separator = indicatorName+p;
if(ObjectFind(separator)==-1)
ObjectCreate(separator,OBJ_TREND,window,0,0);
ObjectSet(separator,OBJPROP_TIME1,barTime(k-Shift*(barsPerTimeFrame+1)-1));
ObjectSet(separator,OBJPROP_TIME2,barTime(k-Shift*(barsPerTimeFrame+1)-1));
ObjectSet(separator,OBJPROP_PRICE1, 0);
ObjectSet(separator,OBJPROP_PRICE2,100);
ObjectSet(separator,OBJPROP_COLOR ,separatorColor);
ObjectSet(separator,OBJPROP_WIDTH ,2);
separator = indicatorName+p+"shadow";
if(ObjectFind(separator)==-1)
ObjectCreate(separator,OBJ_RECTANGLE,window,0,0);
ObjectSet(separator,OBJPROP_COLOR,shadow);
ObjectSet(separator,OBJPROP_PRICE1,100);
ObjectSet(separator,OBJPROP_PRICE2,0);
ObjectSet(separator,OBJPROP_TIME1,barTime(k-Shift*(barsPerTimeFrame+1)-1));
ObjectSet(separator,OBJPROP_TIME2,barTime(k-ShadowBarsPerTimeFrame-2));
separator = indicatorName+p+"label";
if(ObjectFind(separator)==-1)
ObjectCreate(separator,OBJ_TEXT,window,0,0);
ObjectSet(separator,OBJPROP_TIME1,barTime(k-Shift*(barsPerTimeFrame+1)-5));
ObjectSet(separator,OBJPROP_PRICE1,70);
ObjectSetText(separator,labels[p],9,"Arial",txtColor);
}
//
//
//
//
//
SetIndexDrawBegin(0,Bars-k);
SetIndexDrawBegin(1,Bars-k);
return(0);
}
//+------------------------------------------------------------------+
//+ Custom functions and procedures +
//+------------------------------------------------------------------+
int barTime(int a)
{
if(a<0)
return(Time[0]+Period()*60*MathAbs(a));
else return(Time[a]);
}
//+------------------------------------------------------------------+
//+ +
//+------------------------------------------------------------------+
//
//
//
//
//
int stringToTimeFrame(string TimeFrame)
{
int TimeFrameInt=0;
if (TimeFrame=="M1") TimeFrameInt=PERIOD_M1;
if (TimeFrame=="M5") TimeFrameInt=PERIOD_M5;
if (TimeFrame=="M15") TimeFrameInt=PERIOD_M15;
if (TimeFrame=="M30") TimeFrameInt=PERIOD_M30;
if (TimeFrame=="H1") TimeFrameInt=PERIOD_H1;
if (TimeFrame=="H4") TimeFrameInt=PERIOD_H4;
if (TimeFrame=="D1") TimeFrameInt=PERIOD_D1;
if (TimeFrame=="W1") TimeFrameInt=PERIOD_W1;
if (TimeFrame=="MN") TimeFrameInt=PERIOD_MN1;
return(TimeFrameInt);
}
//
//
//
//
//
string StringUpperCase(string str)
{
string s = str;
int lenght = StringLen(str) - 1;
int char;
while(lenght >= 0)
{
char = StringGetChar(s, lenght);
//
//
//
//
//
if((char > 96 && char < 123) || (char > 223 && char < 256))
s = StringSetChar(s, lenght, char - 32);
else
if(char > -33 && char < 0)
s = StringSetChar(s, lenght, char + 224);
//
//
//
//
//
lenght--;
}
//
//
//
//
//
return(s);
}
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---