Mcandles indicator

How to create strategies and indicators
Message
Author
goatsnake47
Posts: 5
Joined: Sun Aug 07, 2016 6:34 pm

Mcandles indicator

#1 Postby goatsnake47 » Mon Aug 08, 2016 7:27 pm

Hello,
Does anyone have this for FT2? Would someone be able to code for FT2?
Attachments
mcandles.PNG
mcandles.PNG (83.21 KiB) Viewed 2827 times
GBPNZDproM5 mcandle.png
GBPNZDproM5 mcandle.png (82.2 KiB) Viewed 2827 times

goatsnake47
Posts: 5
Joined: Sun Aug 07, 2016 6:34 pm

Re: Mcandles indicator

#2 Postby goatsnake47 » Mon Aug 08, 2016 7:29 pm

//+------------------------------------------------------------------+
//| M-Candles.mq4 |
//| îðèãèíàëüíàÿ èäåÿ äëÿ H1 è âûøå - Êèì Èãîðü Â. aka KimIV |
//| http://www.kimiv.ru |
//| Ïåðåïèñàë äëÿ ñòàíäàðòíûõ òàéìôðåéìîâ - Ìèõàèë Æèòíåâ |
//| ICQ 138092006 |
//| 2008.09.05 Íà ëþáîì ãðàôèêå ïîêàçûâàåò ñâå÷è ñòàðøèõ ÒÔ |
//+------------------------------------------------------------------+
#property copyright "Æèòíåâ Ìèõàèë aka MikeZTN"
#property link "ICQ 138092006"

#property indicator_chart_window

//------- Âíåøíèå ïàðàìåòðû ------------------------------------------
extern int TFBar = 60; // Ïåðèîä ñòàðøèõ ñâå÷åê
extern bool bcgr = false; // objbcgr

extern int NumberOfBar = 100; // Êîëè÷åñòâî ñòàðøèõ ñâå÷åê
extern color ColorUp = Green;//0x003300; // Öâåò âîñõîäÿùåé ñâå÷è
extern color ColorDown = Red;//0x000033; // Öâåò íèñõîäÿùåé ñâå÷è

//------- Ãëîáàëüíûå ïåðåìåííûå --------------------------------------

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void init() {
int i;

for (i=0; i<NumberOfBar; i++) {
ObjectDelete("BodyTF"+TFBar+"Bar"+i);
ObjectDelete("ShadowTFh"+TFBar+"Bar" + i);
ObjectDelete("ShadowTFl"+TFBar+"Bar" + i);

}
for (i=0; i<NumberOfBar; i++) {
ObjectCreate("BodyTF"+TFBar+"Bar"+i, OBJ_RECTANGLE, 0, 0,0, 0,0);
ObjectCreate("ShadowTFh"+TFBar+"Bar"+i, OBJ_TREND, 0, 0,0, 0,0);
ObjectCreate("ShadowTFl"+TFBar+"Bar"+i, OBJ_TREND, 0, 0,0, 0,0);

}
Comment("");
}

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
void deinit() {
// Óäàëåíèå îáúåêòîâ
for (int i=0; i<NumberOfBar; i++) {
ObjectDelete("BodyTF"+TFBar+"Bar"+i);
ObjectDelete("ShadowTFh"+TFBar+"Bar" + i);
ObjectDelete("ShadowTFl"+TFBar+"Bar" + i);

}
Comment("");
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start() {
int shb=0, sh1=1, d;
double po, pc; // Öåíû îòêðûòèÿ è çàêðûòèÿ ñòàðøèõ ñâå÷åê
double ph=0, pl=500; // Öåíû õàé è ëîó ñòàðøèõ ñâå÷åê
datetime to, tc, ts; // Âðåìÿ îòêðûòèÿ, çàêðûòèÿ è òåíåé ñòàðøèõ ñâå÷åê


bool OK_Period=false;
switch (TFBar)
{
case 1:OK_Period=true;break;
case 5:OK_Period=true;break;
case 15:OK_Period=true;break;
case 30:OK_Period=true;break;
case 60:OK_Period=true;break;
case 240:OK_Period=true;break;
case 1440:OK_Period=true;break;
case 10080:OK_Period=true;break;
case 43200:OK_Period=true;break;
}
if (OK_Period==false)
{
Comment("TFBar != 1,5,15,30,60,240(H4), 1440(D1),10080(W1), 43200(MN) !");
// Comment("Âû ââåëè íåñòàíäàðòíóþ öèôðó òàéìôðåéìà TFBar! Íåîáõîäèìî ââåñòè îäíó èç ñëåäóþùèõ: 1,5,15,30,60,240,1440 è ò.ä.");
return(0);
}
if (Period()>TFBar)
{
Comment("mCandles: TFBar<"+Period());//Çàäàâàåìûé ñòàíäàðòíûé ïåðèîä äîëæåí áûòü áîëüøå òåêóùåãî! (Òåêóùèé ðàâåí " + Period() + ")");
// Comment("Çàäàâàåìûé ñòàíäàðòíûé ïåðèîä äîëæåí áûòü áîëüøå òåêóùåãî! (Òåêóùèé ðàâåí " + Period() + ")");
return(0);
}

shb=0;
// Áåæèì ïî ñòàðøèì ñâå÷êàì
while (shb<NumberOfBar)
{
to = iTime(Symbol(), TFBar, shb);
tc = iTime(Symbol(), TFBar, shb) + TFBar*60;
po = iOpen(Symbol(), TFBar, shb);
pc = iClose(Symbol(), TFBar, shb);
ph = iHigh(Symbol(), TFBar, shb);
pl = iLow(Symbol(), TFBar, shb);
//óñòàíàâëèâàåì ðåêòàíãåëû
ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_TIME1, to); //âðåìÿ îòêðûòèÿ
ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_PRICE1, po); //öåíà îòêðûòèÿ
ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_TIME2, tc); //âðåìÿ çàêðûòèÿ
ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_PRICE2, pc); //öåíà çàêðûòèÿ
ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_STYLE, STYLE_SOLID);
ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_WIDTH, 2);
ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_BACK, bcgr);
//óñòàíàâëèâàåì òåíè hl
ts = to + MathRound((TFBar*60)/2);
ObjectSet("ShadowTFh"+TFBar+"Bar"+shb, OBJPROP_TIME1, ts);
ObjectSet("ShadowTFh"+TFBar+"Bar"+shb, OBJPROP_PRICE1, ph);
ObjectSet("ShadowTFh"+TFBar+"Bar"+shb, OBJPROP_TIME2, ts);
ObjectSet("ShadowTFh"+TFBar+"Bar"+shb, OBJPROP_PRICE2, MathMax(po,pc));
ObjectSet("ShadowTFh"+TFBar+"Bar"+shb, OBJPROP_STYLE, STYLE_SOLID);
ObjectSet("ShadowTFh"+TFBar+"Bar"+shb, OBJPROP_WIDTH, 3);
ObjectSet("ShadowTFh"+TFBar+"Bar"+shb, OBJPROP_BACK, bcgr);
ObjectSet("ShadowTFh"+TFBar+"Bar"+shb, OBJPROP_RAY, False);

ObjectSet("ShadowTFl"+TFBar+"Bar"+shb, OBJPROP_TIME1, ts);
ObjectSet("ShadowTFl"+TFBar+"Bar"+shb, OBJPROP_PRICE1, MathMin(po,pc));
ObjectSet("ShadowTFl"+TFBar+"Bar"+shb, OBJPROP_TIME2, ts);
ObjectSet("ShadowTFl"+TFBar+"Bar"+shb, OBJPROP_PRICE2, pl);
ObjectSet("ShadowTFl"+TFBar+"Bar"+shb, OBJPROP_STYLE, STYLE_SOLID);
ObjectSet("ShadowTFl"+TFBar+"Bar"+shb, OBJPROP_WIDTH, 3);
ObjectSet("ShadowTFl"+TFBar+"Bar"+shb, OBJPROP_BACK, bcgr);
ObjectSet("ShadowTFl"+TFBar+"Bar"+shb, OBJPROP_RAY, False);



//óñòàíàâëèâàåì öâåòà äëÿ âñåõ îáúåêòîâ
if (po<pc) {
ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_COLOR, ColorUp);
ObjectSet("ShadowTFh"+TFBar+"Bar"+shb, OBJPROP_COLOR, ColorUp);
ObjectSet("ShadowTFl"+TFBar+"Bar"+shb, OBJPROP_COLOR, ColorUp);

} else {
ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_COLOR, ColorDown);
ObjectSet("ShadowTFh"+TFBar+"Bar"+shb, OBJPROP_COLOR, ColorDown);
ObjectSet("ShadowTFl"+TFBar+"Bar"+shb, OBJPROP_COLOR, ColorDown);

}
shb++;
}


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

jfdelosrios
Posts: 34
Joined: Sat Feb 13, 2016 6:26 am

solved

#3 Postby jfdelosrios » Fri Aug 12, 2016 6:20 am

do you need a indicator like this?
:)

https://youtu.be/sdnlRKQPr0g


Return to “FT API”

Who is online

Users browsing this forum: No registered users and 1 guest