[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 71

 
r772ra , artmedia70

Thank you, it's working!
 
artmedia70:

Here's a tip:

NormalizeDouble(Low[i]-Low[i+1],Digits)<=3*Point --- difference of adjacent bars. If the condition is not fulfilled -> Return(False); (Returns false)

Return(False) after the loop has been passed

We can do it in a different way:

If the condition NormalizeDouble(Low[i]-Low[i+1],Digits)<=3*Point is true, increase the adjacent bars counter (initially equal to zero) by 1,

if the condition is false, we return the value of the adjacent bar counter.

The bigger the number returned by the function, the stronger the set. If zero is returned - the setup does not exist.



I do not think the price should be normalized because we only need to compare with an integer. It is better to useMathAbs(double value) function, so that if one of the prices is higher than the other, the sign on the output is always positive.

Here is another point. It turns out we don't need a loop at all!

We can simply use a function with a counter. We continuously check 2 adjacent bars for extrema, and if they are the same, the counter is incremented by 1 (initially it will be 0 of course). Next, on the next new bar we conduct a similar check. If extrema are equal, the counter will be incremented by 1, etc. A loop is not needed here along the way, right?

After all, we do not know how many bars we will have with the same value of extremum and thus there is no point in specifying the shift parameter in the history.

 
Notter:

There is a lot of talk about high-frequency trading. They say HFT beats them all. What is its principal advantage over us? The fact that a short ping is a good thing in itself is understandable, but it takes more than a millisecond to make a trade :) What new quality appears in HFT and how do the algorithms differ in principle?

Thank you.


You drive a Zaporozhets, and these guys drive a Ferrari. Can you overtake? (It's not about algorithms)
 
YOUNGA:

You drive a Zaporozhets and these guys drive a Ferrari. Can you overtake? (It's not about algorithms)
Zaporozhets need a little bit of work. Then not only Ferrari can be "done".
 
YOUNGA:

You drive a Zaporozhets, and these guys drive a Ferrari. Can you outrun them?

There is, however, a fundamental difference.

At least take risk/return. If HFT registers profit by points, then it obviously does not place stops and closes positions by other criteria. It may be that any tick against a position is an exit.) But then where is the profit coming from?

 
Again for help.


How do I determine which side the SMA crosses prices from?
 
hoz:


I don't think we need to normalize the price, because we only need to compare to an integer. It is better to useMathAbs(double value) function, so that if one of the prices is higher than the other, the sign of the output is always positive.

Here is another point. It turns out that we don't need a loop at all!

We can simply use a function with a counter. We continuously check 2 adjacent bars for extrema, and if they are the same, the counter is incremented by 1 (initially it will be 0 of course). Next, on the next new bar we conduct a similar check. If extrema are equal, the counter will be incremented by 1, etc. A loop is not needed here as we go along, right?

After all, we do not know how many bars we will have with the same extremum value and thus there is no point in specifying the shift parameter in the history.

Of course, MathAbs() is needed there - I wrote it out of the blue, sitting at the wheel - you can't write much, moreover I gave a tip for it. Normalize prices, because comparing real numbers requires normalization, while we are not comparing with an integer (because 3*Point is int*double- int to double conversion). I would still make a function that would compare bars on every tick - I'm used to thinking immediately for the real. If the EA is disabled for some reason, the variable storing the counter value will be reset when the EA is restarted - this is not good ... it is a loss of data. But in case of pythmic search (or better to optimize speed), the restart of Expert Advisor in this case is not so bad - it will re-calculate everything. Therefore, it's better to create a separate function which compares a given number of adjacent bars on each new bar for equality (well, as you have it) and returns the number of consecutive bars equal by a given criterion, starting from the first one and further into history for the number of bars which have been passed to the function (ten by default...).

In general ... something like this ...

 
md4RM:
Again for help.


How can I tell which side the SMA is crossed by the price?

If (

iMA(Symbol(), Period(), 1, 0, MODE_SMA, PRICE_CLOSE, 2) <= SMA(blah, blah, blah, 2)

и

iMA(Symbol(), Period(), 1, 0, MODE_SMA, PRICE_CLOSE, 1) > SMA(blah, blah, blah, 1)

) then

{ price has crossed your SMA from down to up on the first bar}

 

Thank you, I found the mistake.

 

Good afternoon, please help. I downloaded the VininI_HMA indicator and tried to insert it into the EA template, but the EA does not open trades. The compilation went well.

Condition for SELL (Sigj1==EMPTY_VALUE)&& (Sigj2!=EMPTY_VALUE)&& (Sigj1!=EMPTY_VALUE)&& (Sigj2!=EMPTY_VALUE)

Conditions for Buy (sigj1==EMPTY_VALUE)&& (sigj2!=EMPTY_VALUE)&& (sigj1!=EMPTY_VALUE)&& (sigj2!=EMPTY_VALUE)

double sigz1 = iCustom(NULL,0, "VininI_HMA_sound&Alert",period,method,price,sdvig,0,1);
double sigz2 = iCustom(NULL,0, "VininI_HMA_sound&Alert",period,method,price,sdvig,0,2);
double sigz1 = iCustom(NULL,0, "VininI_HMA_sound&Alert",period,method,price,sdvig,1,1);
double sigz2 = iCustom(NULL,0, "VininI_HMA_sound&Alert",period,method,price,sdvig,1,2);
double sigk1 = iCustom(NULL,0, "VininI_HMA_sound&Alert",period,method,price,sdvig,2,1);
double sigk2 = iCustom(NULL,0, "VininI_HMA_sound&Alert",period,method,price,sdvig,2,2);

Please tell me where I made a mistake ?