sound alert doesnt work when converting this indic

Created at 02 Oct 2013, 23:12
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
JE

jeanclaude

Joined 02.10.2013

sound alert doesnt work when converting this indic
02 Oct 2013, 23:12


hello everybody

 

i have converted this simple mt4 indic using 2calgo website......

//+------------------------------------------------------------------+
//|                                            Candle_Size_Alert.mq4 |
//|                               Copyright © 2012, Gehtsoft USA LLC |
//|                                            http://fxcodebase.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2012, Gehtsoft USA LLC"
#property link      "http://fxcodebase.com"

#property indicator_chart_window

#property indicator_buffers 2
#property indicator_color1 Yellow

extern int LevelSize=20;
extern bool OnlyLastBar=false;
extern bool EnableAlert=false;

double HighSize[];
double LevelSizePip;

int init()
  {
   IndicatorShortName("Candle size alert");
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexBuffer(0,HighSize);
   SetIndexArrow(0,108);
   LevelSizePip=LevelSize*Point;
   return(0);
  }

int deinit()
  {

   return(0);
  }
  
string PeriodStr()
{
 int P=Period();
 if (P==1) return ("M1");
 if (P==5) return ("M5");
 if (P==15) return ("M15");
 if (P==30) return ("M30");
 if (P==60) return ("H1");
 if (P==240) return ("H4");
 if (P==1440) return ("D1");
 if (P==10080) return ("W1");
 if (P==43200) return ("MN1");
 return ("");
}  

int start()
{
 if (High[0]-Low[0]>=LevelSizePip)
 {
  if (EnableAlert && HighSize[0]==EMPTY_VALUE)
  {
   Alert(Symbol(),", ",PeriodStr(),": Candle size>",LevelSize," pips");
  }
  HighSize[0]=High[0];
 }
 if (OnlyLastBar) 
 {
  HighSize[1]=EMPTY_VALUE;
 }
 else
 { 
  if(Bars<=3) return(0);
  int ExtCountedBars=IndicatorCounted();
  if (ExtCountedBars<0) return(-1);
  int    pos=Bars-2;
  if(ExtCountedBars>2) pos=Bars-ExtCountedBars-1;
  while(pos>0)
  {
   if (High[pos]-Low[pos]>=LevelSizePip)
   {
    HighSize[pos]=High[pos];
   }
   pos--;
  } 
 } 
 return(0);
}

 

 

the conversion worked good..........the indic is running but.....:

- i cant change the color of the plotted signal

- i dont receive any alert window and no sound alert also

 

anybody could help me to solve that please ?

 

thks a lot


@jeanclaude
Replies

algotrader
03 Oct 2013, 08:54 ( Updated at: 21 Dec 2023, 09:20 )

Hello jeanclaude,

i cant change the color of the plotted signal

cAlgo doesn't support colors as a parameters for indicators, so you need to specify another color in mq4 code and then convert indicator:

i dont receive any alert window and no sound alert also

I'am investigating this issue about missing alert window. I will let you know when it will be fixed.


@algotrader

jeanclaude
03 Oct 2013, 13:43

hello

 

thanks for the answer.........no problem i am gonna change the color parameter in mq4 code......

According to the window and the sound alert, i really hope u will find a solution........

best regards

jean claude


@jeanclaude

algotrader
03 Oct 2013, 21:16

jeanclaude, problem with alert window in your indicator has been fixed. Please reconvert your indicator.


@algotrader

jeanclaude
04 Oct 2013, 02:59

wow thks a lot..........good job man..........

may i ask you how to have a sound when the alert window is coming ?

should i put a soundfile somewhere in ctrader ?

 

and also even if i can see that code line     if (High[0] - Low[0] >= LevelSizePip)  the alert window is coming only when high - low > levelsizepip..........Do you know why please ?

 

best regards

jean claude


@jeanclaude

algotrader
05 Oct 2013, 22:42 ( Updated at: 21 Dec 2023, 09:20 )

Hi jeanclaude,

I'm glad to tell you that now sound in alert window is supported. So you don't need to put sound file anywhere, just reconvert your indicator.

and also even if i can see that code line     if (High[0] - Low[0] >= LevelSizePip)  the alert window is coming only when high - low > levelsizepip..........Do you know why please ?

To check this behavior I wrote indicator that shows height of bar in points:

 

Regarding to this picture everything is good.


@algotrader