[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 112

 
Roger >> :
It says "Warning" in Russian, nothing more. What kind of problem is that? Ask them personally about the data from your brokerage company.
If you have MTS sensitive to changes at different brokers, that is really a problem.

>> Sorry, but I'm only asking if it's possible to download quotes history not from Meta Quotes server, but from a separate broker's server. I will ask you to keep your assumptions to yourself (no offence), because MTS is not mine and I'm going to check if it is sensitive to changes of brokerage companies.

 
Atis >> :
How do I catch the appearance of a new bar in an EA?

Like this :

static int LastBars;

IBARS = iBars(Symbol(), Period());

if (LastBars != IBARS)
{

LastBars = IBARS;

.......

......

.......

}

 
ssd >> :

Like this :

static int LastBars;

IBARS = iBars(Symbol(), Period());

if (LastBars != IBARS)
{

LastBars = IBARS;

.......

......

.......

}

Yeah so there is no event on the appearance of a new candle ok thank you very much.

 

That's it, it's time to learn how to program, now I'm going to ask a lot of nerdy questions: )

here we go... one.

What the heck is this? A simple Expert Advisor, what have I done wrong? * '\end_of_program * I'm sick of this error, and not only in this script.


extern int Lots = 0.1;
extern int stoploss = 50;
extern int takeprofit = 50;
extern int iWPRperiod1 = 50;
extern int iWPRperiod2 = 60;
extern int magic = 555;

int start()
{

int stoploss, takeprofit, iWPRperiod1,iWPRperiod2, magic, lots;


if (iWPR(NULL,0,iWPRperiod1,0)>iWPR(NULL,0,iWPRperiod2,0))
{
OrderSend(NULL, OP_BUY,1,Ask,lots,stoploss,takeprofit,0,magic,0,Red);
}
if (iWPR(NULL,0,iWPRperiod1,0)<iWPR(NULL,0,iWPRperiod2,0))
{
OrderSend(NULL, OP_BUY,1,Ask,Lots,stoploss,takeprofit,0,magic,0,Red);
}
return(0);
}


 

First, check the braces: they are all opening brackets. {...{ instead of {...} The first error tells you that the brackets are not placed correctly in the program.

Then you'll get a message that you're missing semicolons at the end of a line, and you'll even get a line number.

And there will be much more of this kind of goodness because reporting errors is a good deed, not ....... Translate the error messages, almost everything is clear.

 

Hi all. Here's a question:

Which version of the code is less demanding on system resources(and time)?

I've written an EA and it looks quite tricky, imho. It takes a long time to test it.

I'm thinking, maybe shorten the calculations somehow.

In this case, is it easier to execute OrderType() or extract element of array mass[i,1]?

...

OrderSelect(mass[i,0],SELECT_BY_TICKET); //выбрать ордер
sl=TRALING(OrderType()); //вычисляет стоп-лосс
...

//или

...

OrderSelect(mass[i,0],SELECT_BY_TICKET); //выбрать ордер
sl=TRALING_BARS(mass[i,1]); //вычисляет стоп-лосс
...

Same as OrderStopLoss etc.

Or for example:

...

//пересекла ли главная линия стохастика сигнальную линию сверху вниз

if(

iStochastic(Symbol(),0,KperiodF,DperiodF,SlowlingF,methodF,PriceFieldF,0,shiftF)>

iStochastic(Symbol(),0,KperiodF,DperiodF,SlowlingF,methodF,PriceFieldF,1,shiftF)&&
iStochastic(Symbol(),0,KperiodF,DperiodF,SlowlingF,methodF,PriceFieldF,0,0)<

iStochastic(Symbol(),0,KperiodF,DperiodF,SlowlingF,methodF,PriceFieldF,1,0))

...

//и ниже

...

//пересекла ли главная линия стохастика сигнальную линию cнизу вверх
if(

iStochastic(Symbol(),0,KperiodF,DperiodF,SlowlingF,methodF,PriceFieldF,0,shiftF)<
iStochastic(Symbol(),0,KperiodF,DperiodF,SlowlingF,methodF,PriceFieldF,1,shiftF)&&
iStochastic(Symbol(),0,KperiodF,DperiodF,SlowlingF,methodF,PriceFieldF,0,0)>
iStochastic(Symbol(),0,KperiodF,DperiodF,SlowlingF,methodF,PriceFieldF,1,0))

...

does it make sense to create variables and assign them function values and then use them, or not?

will be of type

...

double a=iStochastic(Symbol(),0,KperiodF,DperiodF,SlowlingF,methodF,PriceFieldF,0,shiftF);

double b=iStochastic(Symbol(),0,KperiodF,DperiodF,SlowlingF,methodF,PriceFieldF,1,shiftF);

double c=iStochastic(Symbol(),0,KperiodF,DperiodF,SlowlingF,methodF,PriceFieldF,0,0);

double d=iStochastic(Symbol(),0,KperiodF,DperiodF,SlowlingF,methodF,PriceFieldF,1,0);

...

//пересекла ли главная линия стохастика сигнальную линию сверху вниз

if( a>b && c<d )

...

//пересекла ли главная линия стохастика сигнальную линию cнизу вверх

if( a<b && c>d )

...

Is it more costly to calculate each time a stop, or to create a variable, count a stop once and then read the value from the variable?

Please advise, programmers. Thank you

 

No, I'm not going to fix your codes on a permanent basis. You have the technology to find it.

The only thing I should note is that I don't like the notation you use. With this arrangement of brackets, IMHO, the error is harder to find. Look at how KimIV writes.

 
mukata писал(а) >>

Hi all. Here's a question:

Which version of the code is less demanding on system resources(and time)?

I've written an EA and it looks quite tricky, imho. It takes a long time to test it.

I think I may somehow reduce the calculations.

In this case, is it easier to execute OrderType() or extract array element mass[i,1]?

Is it more expensive to count each time a stop, or to create a variable, count a stop once and then read the value from the variable?

Please advise, programmers. Thank you

Do you have to work on 0 bar?

You're trying to shorten things so much that I cannot help thinking that it's not the point...

 
FOREXMASTER писал(а) >>
Where did you hide your code? I was just going to tweak it, and it's already...
 
StatBars >> :

Do you have to work at 0 bar?

It's just that you're already trying to shorten things so much that you can't help but think that it's not about them...

No, I'm not a pipser, if that's what you mean...

and why wouldn't it work...

It's just that the machine is already loaded to the limit, the CPU is boiling... And when you start running it, it'll start counting...

I don't want to rewrite it for nothing - there are a lot of such things in programs...

so what about the question?