[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 121

 
Vinin >> :

It is better to calculate stochastic and signal line values first. And then compare them. I just don't like this style. It results in some kind of blindness. And it is easier to make a mistake.

If() in the metaquotes variant makes full calculation of the logical expression. It would be desirable to make it as simple as possible. It is just if() is one of the slowest operations.

There is also such a notion as "chattering" on the zero bar. There may be cases when the signal will be repeated on one bar more than once. And it may even fail to lock. It was a false signal. This is why we try to take values from the formed bars. But in this case we should use the opening prices. Although, there may be other variants.

The "chattering" on the zero bar is clear, but it is another issue.

Thanks for the "slowness" of the if operation - it was enlightening.

So it's better to create for example variables

x=iStochastic(Symbol(),0,KperiodF,DperiodF,SlowingF,PriceFieldF,0,shiftF);

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

and then if(x>y) etc. right?

" I just don't like this style. It's kind of blind. And it's also easier to make a mistake."

How would you write it? Teach me.

 
Hello, everyone. There is a request. Somewhere on the net I've seen something similar, but I haven't found it again. I need a script which opens trades with the lot size calculated on the value of stoploss. I.e. I use external variables to set % of deposit or amount which I am ready to risk and stop loss value in pips. Depending on the value of point and stop loss the script calculates the lot and places an order. If you have such a script, please do not hesitate to post it. I want to give you a tip where you can download it. Thanks in advance.
 
mukata писал(а) >>

The "chatter" at bar zero is understandable, but that's another issue...

Thanks for the "slowness" of the if operation - that's enlightening.

In other words, it is better to create for example variables

x=iStochastic(Symbol(),0,KperiodF,DperiodF,SlowingF,PriceFieldF,0,shiftF);

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

and then if(x>y) etc. right?

" I just don't like this style. It's kind of blind. And it's easier to make a mistake."

How would you write it? Teach me.

The way I usually do crossing control is this. There's an intersection, further processing.

string _Symbol=Symbol(); // чтобы лишний раз не вызывать функцию

double Stoch0  = iStochastic(_Symbol, 0, KperiodF, DperiodF, SlowlingF, methodF, PriceFieldF, 0,     0);
double Stoch1  = iStochastic(_Symbol, 0, KperiodF, DperiodF, SlowlingF, methodF, PriceFieldF, 0, shiftF);
double Signal0 = iStochastic(_Symbol, 0, KperiodF, DperiodF, SlowlingF, methodF, PriceFieldF, 1,     0);
double Signal1 = iStochastic(_Symbol, 0, KperiodF, D periodF, SlowlingF, methodF, PriceFieldF, 1, shiftF);


//пересекла ли главная линия стохастика сигнальную линию 
if (( Stoch0  - Signal0 )*( Stoch1  - Signal1) <0) {
   // Есть пересечение, дальше проверяем положение (как пересекла мы не знаем пока еще)

}
 
Vinin >> :

I usually do the crossing control like this. There is an intersection, further processing.

  // Есть пересечение, дальше проверяем положение (как пересекла мы не знаем пока еще)
Mm-hmm, how efficient!!!
Especially in my tester...:-)
Most of the ticks are without crossover, but it turns out I counted every tick: if such a tick is less than another, or another is less than such.....................
Thanks very much, got to work.
 
mukata писал(а) >>

Only my design has one disadvantage. If the values coincide on one of the calculated bars, there may be a signal skip. Although this is unlikely, it can happen.

 
StatBars >> :

Thank you

 
rsi >> :

That's what you say: send an order during the day with conditions 1 & 2, and at night with conditions 1 & 2 & 3. So you have the fourth day-night condition, but you have mixed it with the third. You can, for example.

Thank you

 

I'd like to ask some knowledgeable people, what is the maximum number of working (and pending) orders possible?

Or is there no such limit?

 
xrym писал(а) >>

I'd like to ask some knowledgeable people, what is the maximum number of working (and pending) orders possible?

Or there is no such limitation.

It should be checked with your brokerage company. You can try to put an endless cycle to see the max:

for(int k=1; k>2; k--)
{
   OrderSend(Symbol(),OP_BUY,0.1,Ask,1,0,0,"testing order");
   Alert("Текущее количество ордеров: ",OrdersTotal());
}
The last alert will be the maximum number of orders in your DC.
 

By the way, OrdersTotal() returns a number of int type. And int can take values:

Внутреннее представление - длинное целое число размером 4 байта. Целые константы могут принимать значения от -2147483648 до 2147483647. Если константа превышает указанный диапазон, то результат не определен.

I.e. theoretically maximum number of oders: 2147483647
Reason: