ICustom function - page 22

 
SantaClaus:
English is not my mother language but I really didn't think that my question was that wrong. Instead of "marking words", lets find a solution to my problem. I try the question again.

What is the best way for my EA to recognize simple puts and calls from my indicator?

Obviously my code didn't work and I tried to change the "1" to a "0" as you told me to.

Post (attach) your code that does not work here - the mql files that you are testing and which you wrote so far

 

It's my private code so I don't want to share it. But what more do you need to see than the code I have provided?

Is there something I have forgot?

 
SantaClaus:
It's my private code so I don't want to share it. But what more do you need to see than the code I have provided? Is there something I have forgot?

You mean you want someone to help you with coding, but you do not want to show the code to be checked for errors, but instead you are claiming that all the advices you have received, and that are working in thousands and thousands of other codes, are not working for you?

OK. I do understand your position now. Good luck with your coding

Happy trading

 

Private code that does not work? Interesting

 

Two of my posts have been deleted for some reason that I don't know.

however, the problem that encountered was that I had some other buffers that disturbed the one I was trying to read. I now have a working solution.

 

I need some help please.. How do you send symbol parameters which have a suffix(micro) to a function containing icustom. if i'm not using a function i put the symbol name in double quotes and it works eg icustom("EURUSDmicro",0,channel-signal",2,1) but when i use a function the double quotes are not passed over .please see the following code what i mean

void OnTick()

{

CalcDisplay("EURUSDmicro"); //--------FUNCTION CALL-------

}

void CalcDisplay(string TxtCurrency) //--------FUNCTION-------

{

double Value=icustom(TxtCurrency,0,channel-signal",2,1);

...

...

..

}

 
Richard Sidric:
I need some help please.. How do you send symbol parameters which have a suffix(micro) to a function containing icustom. if i'm not using a function i put the symbol name in double quotes and it works eg icustom("EURUSDmicro",0,channel-signal",2,1) but when i use a function the double quotes are not passed over .please see the following code what i mean

void OnTick()

{

CalcDisplay("EURUSDmicro"); //--------FUNCTION CALL-------

}

void CalcDisplay(string TxtCurrency) //--------FUNCTION-------

{

double Value=icustom(TxtCurrency,0,channel-signal",2,1);

...

...

..

}

You do not need to pass quotes. All that is need is that it is a string.

___________________

PS: in you iCiustom call you are missing one quote. It is like this now :

double Value=icustom(TxtCurrency,0,channel-signal",2,1);

and it has to be like this :

double Value=icustom(TxtCurrency,0,"channel-signal",2,1);

 

hi all of you i have one t4 indicator below attached just i want to know how can i use this for robo trading and robo trading or ea are same or not

( i allready use it manual trading sit in front of computer but )

if i use this for automated trading then how please help me any one thanks in advance

//------------------------------------------------------------------

// original ised and first implementation by mony

// tris version by mladen

//------------------------------------------------------------------

#property copyright "mony & mladen"

#property link "made at www.forex.tsd.com"

#property indicator_chart_window

#property indicator_buffers 5

#property indicator_color1 MediumBlue

#property indicator_color2 Red

#property indicator_color3 MediumBlue

#property indicator_color4 Red

#property indicator_color5 Red

#property indicator_width3 3

#property indicator_width4 3

#property indicator_width5 3

#property strict

//

//

//

//

//

//

enum enDisplay

{

dis_line, // Display colored line

dis_bars, // Display colored bars

dis_both // Display both colored lines and bars

};

extern int CCIperiod = 3; // CCI period

extern int ATRperiod = 300; // ATR period

extern ENUM_APPLIED_PRICE applied_price = PRICE_TYPICAL; // Price to use

extern enDisplay DisplayType = dis_line; // Display type

extern bool alertsOn = true; // Turn alerts on

extern bool alertsOnCurrent = false; // Alerts on current (still opened) bar

extern bool alertsMessage = true; // Alerts should display pop-up message

extern bool alertsSound = true; // Alerts should play sound

extern bool alertsNotify = true; // Alerts should send notification

extern bool alertsEmail = false; // Alerts should send enail

extern string soundFile = "o.wma"; // Sound file t use for sound alerts

double TrLine[];

double TrendDowna[];

double TrendDownb[];

double HistUp[];

double HistDn[];

double trend[];

//------------------------------------------------------------------

//

//------------------------------------------------------------------

//

//

//

//

//

int init()

{

IndicatorBuffers(6);

int styleLine = DRAW_LINE; if (DisplayType==dis_bars) styleLine=DRAW_NONE;

int styleBars = DRAW_HISTOGRAM; if (DisplayType==dis_line) styleBars=DRAW_NONE;

SetIndexBuffer(0, HistUp); SetIndexStyle(0,styleBars);

SetIndexBuffer(1, HistDn); SetIndexStyle(1,styleBars);

SetIndexBuffer(2, TrLine); SetIndexStyle(2,styleLine);

SetIndexBuffer(3, TrendDowna); SetIndexStyle(3,styleLine);

SetIndexBuffer(4, TrendDownb); SetIndexStyle(4,styleLine);

SetIndexBuffer(5, trend);

return(0);

}

int deinit(){ return(0); }

//------------------------------------------------------------------

//

//------------------------------------------------------------------

//

//

//

//

//

int start()

{

int counted_bars=IndicatorCounted();

if(counted_bars<0) return(-1);

if(counted_bars>0) counted_bars--;

int limit = MathMin(Bars-counted_bars,Bars-1);

//

//

//

//

//

if (trend[limit]==-1) CleanPoint(limit,TrendDowna,TrendDownb);

for(int i=limit; i >= 0; i--)

{

double cciTrendNow = iCCI(NULL, 0, CCIperiod, applied_price, i);

if (cciTrendNow >= 0)

{

TrLine = NormalizeDouble(Low - iATR(NULL, 0, ATRperiod, i),Digits);

if (i<(Bars-1) && TrLine < TrLine) TrLine = TrLine;

}

if (cciTrendNow <= 0)

{

TrLine = NormalizeDouble(High + iATR(NULL, 0, ATRperiod, i),Digits);

if (i TrLine) TrLine = TrLine;

}

//

//

//

//

//

TrendDowna = EMPTY_VALUE;

TrendDownb = EMPTY_VALUE;

if (i<(Bars-1))

{

trend = trend;

if (TrLine> TrLine) trend = 1;

if (TrLine< TrLine) trend =-1;

if (trend == -1) PlotPoint(i,TrendDowna,TrendDownb,TrLine);

if (trend == 1) { HistUp = High; HistDn = Low; }

if (trend == -1) { HistDn = High; HistUp = Low; }

}

}

manageAlerts();

return(0);

}

//+-------------------------------------------------------------------

//|

//+-------------------------------------------------------------------

//

//

//

//

//

void manageAlerts()

{

if (alertsOn)

{

int whichBar = 1; if (alertsOnCurrent) whichBar = 0;

if (trend[whichBar] != trend[whichBar+1])

{

if (trend[whichBar] == 1) doAlert(whichBar,"up");

if (trend[whichBar] ==-1) doAlert(whichBar,"down");

}

}

}

//

//

//

//

//

void doAlert(int forBar, string doWhat)

{

static string previousAlert="nothing";

static datetime previousTime;

string message;

if (previousAlert != doWhat || previousTime != Time[forBar]) {

previousAlert = doWhat;

previousTime = Time[forBar];

//

//

//

//

//

message = Symbol()+" at "+TimeToStr(TimeLocal(),TIME_SECONDS)+" SP MY trend changed to "+doWhat;

if (alertsMessage) Alert(message);

if (alertsNotify) SendNotification(message);

if (alertsEmail) SendMail(Symbol()+" S P MY",message);

if (alertsSound) PlaySound(soundFile);

}

}

//-------------------------------------------------------------------

//

//-------------------------------------------------------------------

//

//

//

//

//

void CleanPoint(int i,double& first[],double& second[])

{

if (i>=Bars-3) return;

if ((second != EMPTY_VALUE) && (second != EMPTY_VALUE))

second = EMPTY_VALUE;

else

if ((first != EMPTY_VALUE) && (first != EMPTY_VALUE) && (first == EMPTY_VALUE))

first = EMPTY_VALUE;

}

void PlotPoint(int i,double& first[],double& second[],double& from[])

{

if (i>=Bars-2) return;

if (first == EMPTY_VALUE)

if (first == EMPTY_VALUE)

{ first = from; first = from; second = EMPTY_VALUE; }

else { second = from; second = from; first = EMPTY_VALUE; }

else { first = from; second = EMPTY_VALUE; }

}

s_p_mony__alerts_1.01.mq4

 
mony:
hi all of you i have one t4 indicator below attached just i want to know how can i use this for robo trading and robo trading or ea are same or not

( i allready use it manual trading sit in front of computer but )

if i use this for automated trading then how please help me any one thanks in advance

//------------------------------------------------------------------

// original ised and first implementation by mony

// tris version by mladen

//------------------------------------------------------------------

#property copyright "mony & mladen"

#property link "made at www.forex.tsd.com"

#property indicator_chart_window

#property indicator_buffers 5

#property indicator_color1 MediumBlue

#property indicator_color2 Red

#property indicator_color3 MediumBlue

#property indicator_color4 Red

#property indicator_color5 Red

#property indicator_width3 3

#property indicator_width4 3

#property indicator_width5 3

#property strict

//

//

//

//

//

//

enum enDisplay

{

dis_line, // Display colored line

dis_bars, // Display colored bars

dis_both // Display both colored lines and bars

};

extern int CCIperiod = 3; // CCI period

extern int ATRperiod = 300; // ATR period

extern ENUM_APPLIED_PRICE applied_price = PRICE_TYPICAL; // Price to use

extern enDisplay DisplayType = dis_line; // Display type

extern bool alertsOn = true; // Turn alerts on

extern bool alertsOnCurrent = false; // Alerts on current (still opened) bar

extern bool alertsMessage = true; // Alerts should display pop-up message

extern bool alertsSound = true; // Alerts should play sound

extern bool alertsNotify = true; // Alerts should send notification

extern bool alertsEmail = false; // Alerts should send enail

extern string soundFile = "o.wma"; // Sound file t use for sound alerts

double TrLine[];

double TrendDowna[];

double TrendDownb[];

double HistUp[];

double HistDn[];

double trend[];

//------------------------------------------------------------------

//

//------------------------------------------------------------------

//

//

//

//

//

int init()

{

IndicatorBuffers(6);

int styleLine = DRAW_LINE; if (DisplayType==dis_bars) styleLine=DRAW_NONE;

int styleBars = DRAW_HISTOGRAM; if (DisplayType==dis_line) styleBars=DRAW_NONE;

SetIndexBuffer(0, HistUp); SetIndexStyle(0,styleBars);

SetIndexBuffer(1, HistDn); SetIndexStyle(1,styleBars);

SetIndexBuffer(2, TrLine); SetIndexStyle(2,styleLine);

SetIndexBuffer(3, TrendDowna); SetIndexStyle(3,styleLine);

SetIndexBuffer(4, TrendDownb); SetIndexStyle(4,styleLine);

SetIndexBuffer(5, trend);

return(0);

}

int deinit(){ return(0); }

//------------------------------------------------------------------

//

//------------------------------------------------------------------

//

//

//

//

//

int start()

{

int counted_bars=IndicatorCounted();

if(counted_bars<0) return(-1);

if(counted_bars>0) counted_bars--;

int limit = MathMin(Bars-counted_bars,Bars-1);

//

//

//

//

//

if (trend[limit]==-1) CleanPoint(limit,TrendDowna,TrendDownb);

for(int i=limit; i >= 0; i--)

{

double cciTrendNow = iCCI(NULL, 0, CCIperiod, applied_price, i);

if (cciTrendNow >= 0)

{

TrLine = NormalizeDouble(Low - iATR(NULL, 0, ATRperiod, i),Digits);

if (i<(Bars-1) && TrLine < TrLine) TrLine = TrLine;

}

if (cciTrendNow <= 0)

{

TrLine = NormalizeDouble(High + iATR(NULL, 0, ATRperiod, i),Digits);

if (i TrLine) TrLine = TrLine;

}

//

//

//

//

//

TrendDowna = EMPTY_VALUE;

TrendDownb = EMPTY_VALUE;

if (i<(Bars-1))

{

trend = trend;

if (TrLine> TrLine) trend = 1;

if (TrLine< TrLine) trend =-1;

if (trend == -1) PlotPoint(i,TrendDowna,TrendDownb,TrLine);

if (trend == 1) { HistUp = High; HistDn = Low; }

if (trend == -1) { HistDn = High; HistUp = Low; }

}

}

manageAlerts();

return(0);

}

//+-------------------------------------------------------------------

//|

//+-------------------------------------------------------------------

//

//

//

//

//

void manageAlerts()

{

if (alertsOn)

{

int whichBar = 1; if (alertsOnCurrent) whichBar = 0;

if (trend[whichBar] != trend[whichBar+1])

{

if (trend[whichBar] == 1) doAlert(whichBar,"up");

if (trend[whichBar] ==-1) doAlert(whichBar,"down");

}

}

}

//

//

//

//

//

void doAlert(int forBar, string doWhat)

{

static string previousAlert="nothing";

static datetime previousTime;

string message;

if (previousAlert != doWhat || previousTime != Time[forBar]) {

previousAlert = doWhat;

previousTime = Time[forBar];

//

//

//

//

//

message = Symbol()+" at "+TimeToStr(TimeLocal(),TIME_SECONDS)+" SP MY trend changed to "+doWhat;

if (alertsMessage) Alert(message);

if (alertsNotify) SendNotification(message);

if (alertsEmail) SendMail(Symbol()+" S P MY",message);

if (alertsSound) PlaySound(soundFile);

}

}

//-------------------------------------------------------------------

//

//-------------------------------------------------------------------

//

//

//

//

//

void CleanPoint(int i,double& first[],double& second[])

{

if (i>=Bars-3) return;

if ((second != EMPTY_VALUE) && (second != EMPTY_VALUE))

second = EMPTY_VALUE;

else

if ((first != EMPTY_VALUE) && (first != EMPTY_VALUE) && (first == EMPTY_VALUE))

first = EMPTY_VALUE;

}

void PlotPoint(int i,double& first[],double& second[],double& from[])

{

if (i>=Bars-2) return;

if (first == EMPTY_VALUE)

if (first == EMPTY_VALUE)

{ first = from; first = from; second = EMPTY_VALUE; }

else { second = from; second = from; first = EMPTY_VALUE; }

else { first = from; second = EMPTY_VALUE; }

}

s_p_mony__alerts_1.01.mq4

Did you try using iCustom() call from the EA yet?

All you have to do is to call the indicator using iCustom() function, read the trend buffer (buffer 5 in metatrader nomination) and when it changes value from -1 to +1 or from +1 to -1 you have a signal

 

sir sir please i am sorry sir ......... i dont know what is iCustom() call .. and where it can i try ??? ...... where i found it in mt4 or when modify indicator just tell me how can i use this S P mony indicator in to automatic tradin / robo trading thats it sir ..................

if this is are all lengthy process then please excuse me and please forget above posts thankyou sir