Ask! - page 164

 

Hi

will this work ? changing Point to mypoint

init() function:

myPoint = 0.0001;

if (Digits < 4) myPoint = 0.01;

 

Could someone please tell me what this is doing ?

Thank you in advance

// analyse now?

bool isAnalyseNow=false;

datetime timeNow = CurTime();

int intervalEval = Evaluate_Interval;

if (Evaluate_Interval == -1) intervalEval = Period();

if (!(intervalEval > 0 && timeNow < timeNextEval)) isAnalyseNow=true;

// analyse chart

if (isAnalyseNow)

{

timeNextEval = timeNow - (timeNow % (intervalEval*60)) + (intervalEval*60);

 

Problems using i

Coder's Guru, I'm trying to call an indicator using the iCustom call from an experimental EA. What happens though is that when I try to incorporate it it takes a long time to compile and when I click on Open Chart all I get is a grey screen with black horizontal lines.

 

I'm attaching the EA for your examination.

I'm attaching the EA for your examination. Below is the piece of code that I have to comment out, because I'm having problems with it. I'm also attaching the Bollinger Squeeze V8 indicator.

double upB = iCustom(Symbol(),0,"Bollinger Squeeze v8", 1, 14, 50, 13, 0,1);

double loB = iCustom(Symbol(),0,"Bollinger Squeeze v8", 1, 14, 50, 13, 1,1);

double upB2 = iCustom(Symbol(),0,"Bollinger Squeeze v8", 1, 14, 50, 13, 2,1);

double loB2 = iCustom(Symbol(),0,"Bollinger Squeeze v8", 1, 14, 50, 13, 3,1);

double mm = iCustom(Symbol(),0,"Bollinger Squeeze v8", 1, 14, 50, 13, 4,1);

double cciline = iCustom(Symbol(),0,"Bollinger Squeeze v8", 1, 14, 50, 13, 5,1);

 

iCustom in array usage

Below, in using a iDemarker indicator, everything compiles and displays ok with the right wingding. But when I try to incorporate a iCustom of the i-Trend indicator, it compiles OK, but does not display the right answer. If the Time frame is 5-minutes, and the i-Trend 0 Buffer (Up) is above 0.00, the iTrend displays that it is below 0.00 wingding??

I must have the array set up wrong for the iCustom statement? Can you diagnose this problem and suggest the right way to use a iCustom indicator in an array???

I would surely appreciate your help!!

Dave

int period[]={1,5,15,30,60,240,1440,10080,43200};

//////////////////////////////DEMARKER//////////////////////////////

for(x=0;x<9;x++)

{

if(iDeMarker(Symbol(),period[x],demark_period,0)>0.5)

ObjectSetText("signal"+x+"6",CharToStr(symbolCodeBuy),fontSize,"Wingdings",signalBuyColor);

else

ObjectSetText("signal"+x+"6",CharToStr(symbolCodeSell),fontSize,"Wingdings",signalSellColor);

}

//////////////////////////////i-Trend//////////////////////////////

for(x=0;x<9;x++)

{

if(iCustom(Symbol(),period[x],"i-Trend",0,0)>0)

ObjectSetText("signal"+x+"7",CharToStr(symbolCodeBuy),fontSize,"Wingdings",signalBuyColor);

else

ObjectSetText("signal"+x+"7",CharToStr(symbolCodeSell),fontSize,"Wingdings",signalSellColor);

}

return(0);
 

EA question

Hello, forgive me for being new to the EA, indicators and scripts. I've been looking for a simple EA that will buy or sell according to what one's needs are.

So, it would buy/sell if pair you specify is up/down by X amount of pips. And It would also let you set a Stop Loss and a preset trailing stop, all before the trade is taken.

With so many complicated indicators, I can't seem to find this.

Help a forex brother out, eh? lol

***I forgot to mention that the EA would start/stop when you wanted it to.***

So if EURUSD is at 1.2768. I turn on the EA and it "senses" the current price of 1.2768. I have pre-set EA to buy if price goes up 30 pips (no matter what the price is at currently. The 1.2768 is just an example.) Then after the buy it would put in a pre-set S/L and trailing stop.

 

Help with Statement Please!

How do I set up a statement to get the Close[0]-Open[0] for each period using the below statement?? Confusing!

int period[]={1,5,15,30,60,240,1440,10080,43200};[/PHP]

[PHP]for(x=0;x<9;x++)

{

??????

}

return(0);
 

Something like this :

int period[]={1,5,15,30,60,240,1440,10080,43200};

double diff[9];

for(int x=0; x<9; x++)

diff[x] = iClose(Symbol(),period[x],0)-iOpen(Symbol(),period[x],0);

[/php]regards

mladen

1Dave7:
How do I set up a statement to get the Close[0]-Open[0] for each period using the below statement?? Confusing!
int period[]={1,5,15,30,60,240,1440,10080,43200};

[php]for(x=0;x<9;x++)

{

??????

}

return(0);
 
mladen:
something like this :
int period[]={1,5,15,30,60,240,1440,10080,43200};

double diff[9];

for(int x=0; x<9; x++)

diff[x] = iclose(symbol(),period[x],0)-iopen(symbol(),period[x],0);

regards

mladen

Thank you ever so much - this will work!!!! I really appreciate your generous assistance!!!! :-)

 

hello all.

i am rookie programmer. and learning step by step.

i am trying to do the next step. creating an Ea from a simple indicator.

what i like to do, is

when blue line is going up i want to do 1 buy lot 0.1,

when the blue line finnishes and goes onto yellow i want it to close the buy and start a sell with 0.1

when the yellow line goes over into blue i want it to close the sell and start a buy.

if possible could someone look at the code below and help me out in where to add the Ea code. i have trouble with the If statements below. i know what they do. but i dont know how to add them to the Ea

thanks.

#property indicator_separate_window

#include

#property indicator_buffers 2

#property indicator_color1 Blue

#property indicator_color2 yellow

#property indicator_level1 0.00

#property indicator_levelcolor Black

extern int a=9;

extern int b=9;

extern int c=5;

double ev=EMPTY_VALUE;

double Up[];

double Dn[];

double newindi[];

double Trend[];

int init()

{

IndicatorBuffers(2);

SetIndexStyle(0,DRAW_LINE,0,2);

SetIndexBuffer(0,Up);

SetIndexLabel(0,"Up");

SetIndexStyle(1,DRAW_LINE,0,2);

SetIndexBuffer(1,Dn);

SetIndexLabel(1,"Dn");

ArraySetAsSeries(newindi,true);

ArraySetAsSeries(Trend,true);

return(0);

}

int deinit()

{

return(0);

}

int start()

{

int counted_bars=IndicatorCounted();

if(counted_bars<0) return(-1); //---- check for possible errors

if(counted_bars>0) counted_bars--; //---- last counted bar will be recounted

int limit = Bars-counted_bars;

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

{

ArrayResize(newindi,Bars);

ArrayResize(Trend,Bars);

Trend = Trend;

newindi = iCustom(NULL,0,"newindi",a,b,c,0,i);

if (newindi > newindi)

{Trend = 1;}

else

if (newindi < newindi)

{Trend = -1;}

if (Trend > 0)

{

Up = newindi;

if (Trend < 0)

{

Up = newindi;

}

Dn = ev;

}

else

if (Trend < 0)

{

Dn = newindi;

if (Trend > 0)

{

Dn = newindi;

}

Up = ev;

}

}

}

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

Reason: