Code HTML:
//+------------------------------------------------------------------+
//| Stochastique Signal étiquette.mq4 |
//| Copyright © 2009, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Dragon Colette Signal filtré 2&3.mq4 |
//| Copyright © 2010, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_width1 0
#property indicator_width2 0
#property indicator_color1 ForestGreen
#property indicator_color2 Red
//---- input parameters
extern color SignalPriceBUY = Lime;
extern color SignalPriceSELL = Red;
//extern bool etiquettes = true;
//---- buffers
double bufferUp[];
double bufferDo[];
double bufferTr[];
double bleu[];
double jaune[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(4);
SetIndexBuffer(0,bufferUp);
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,225); //241
SetIndexLabel(0,"UpArrow");
SetIndexBuffer(1,bufferDo);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,226); //242
SetIndexLabel(1,"DownArrow");
SetIndexBuffer(2,jaune);
SetIndexBuffer(3,bleu);
return(0);
}
int deinit()
{
ObjectsDeleteAll(0,OBJ_ARROW);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int i,limit;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for( i=limit; i >= 0; i--)
{
bleu[i] = iStochastic(NULL, 0, 13, 5, 3, 3, 0, MODE_SIGNAL, i);
jaune[i] = iStochastic(NULL, 0, 13, 5, 3, 3, 0, MODE_MAIN, i);
if (jaune[i+1] > bleu[i+1] && jaune[i] < bleu[i])
{
bufferDo[i]=High[i]+(iATR(NULL,0,20,i)/2);
/*ObjectCreate("SELL SIGNAL: " + DoubleToStr(Time[i],0),OBJ_ARROW,0,Time[i],Close[i]);
ObjectSet("SELL SIGNAL: " + DoubleToStr(Time[i],0),OBJPROP_ARROWCODE,5);
ObjectSet("SELL SIGNAL: " + DoubleToStr(Time[i],0),OBJPROP_COLOR,SignalPriceSELL); */
ObjectCreate("SELL SIGNAL: " + DoubleToStr(Time[i],0), OBJ_ARROW, 0, Time[i], Close[i]);
ObjectSet("SELL SIGNAL: " + DoubleToStr(Time[i],0), OBJPROP_ARROWCODE, SYMBOL_RIGHTPRICE);
ObjectSet("SELL SIGNAL: " + DoubleToStr(Time[i],0), OBJPROP_COLOR, SignalPriceSELL);
}
else bufferDo[i]= EMPTY_VALUE;
if (jaune[i+1] < bleu[i+1] && jaune[i] > bleu[i])
{
bufferUp[i]= Low[i]-(iATR(NULL,0,20,i)/2);
/*ObjectCreate("BUY SIGNAL: " + DoubleToStr(Time[i],0),OBJ_ARROW,0,Time[i],Close[i]);
ObjectSet("BUY SIGNAL: " + DoubleToStr(Time[i],0),OBJPROP_ARROWCODE,5);
ObjectSet("BUY SIGNAL: " + DoubleToStr(Time[i],0),OBJPROP_COLOR,SignalPriceBUY);*/
ObjectCreate("BUY SIGNAL: " + DoubleToStr(Time[i],0), OBJ_ARROW, 0, Time[i], Close[i]);
ObjectSet("BUY SIGNAL: " + DoubleToStr(Time[i],0), OBJPROP_ARROWCODE, SYMBOL_RIGHTPRICE);
ObjectSet("BUY SIGNAL: " + DoubleToStr(Time[i],0), OBJPROP_COLOR, SignalPriceBUY);
}
else bufferUp[i]= EMPTY_VALUE;
}
return(0);
}