Page 1 of 1

Mcandles indicator

Posted: Sun Aug 07, 2016 6:44 pm
by goatsnake47
Hello,
Does anyone have the Mcandle indicator? Or would it be easy to code?
Thanks.

Re: Mcandles indicator

Posted: Mon Aug 08, 2016 9:51 am
by jfdelosrios
do you have it for meta trader ?

Re: Mcandles indicator

Posted: Mon Aug 08, 2016 11:18 am
by goatsnake47
Yes I do have the mt4 version.

Re: Mcandles indicator

Posted: Mon Aug 08, 2016 7:21 pm
by goatsnake47
//+------------------------------------------------------------------+
//| 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);
}
//+------------------------------------------------------------------+

Re: Mcandles indicator

Posted: Tue Aug 09, 2016 9:23 am
by jfdelosrios
if you like, I can help you, my e-mail is jfdelosrios@hotmail.com, my whatsapp is +57 315 860 06 19

solved

Posted: Fri Aug 12, 2016 6:19 am
by jfdelosrios
do you need a indicator like this?
:)

https://youtu.be/sdnlRKQPr0g