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

 
rid >> :

'Useful features from KimIV'.

For example,

if (NumberOfPositions(NULL,OP_BUY, Magic)>=4){/if the open buy position is greater than or equal to =4

What's the purpose of sy? MetaEditor gives error 'sy' - variable not defined... And i, k, op has the same error...


 

I don't know how your code is structured. Do not touch this function at all. Put it all the way down at the end of the code.

And the line

if ( NumberOfPositions(NULL,OP_BUY, Magic)<1){//если нет открытых
                          // бай-позиций с данным магиком

..... ..... .... Здесь выполняете свои действия .....

                                           }

inside the start() function

 
rid >> :

I don't know how your code is structured. Do not touch this function at all. Put it all the way down at the end of the code.

And the line

inside of the start() function.


The thing is, the function itself doesn't work... It says that k, i, sy are unknown variables...

 
ArtY0m >> :

The thing is, the function itself doesn't work... It says that k, i, sy are unknown variables...

You must have lost a parenthesis when transferring, repeat the process. It works for rid, it works for me and it will work for you!

 

Even if you just compile this function:


int NumberOfPositions(string sy="", int op=-1, int mn=-1) {
int i, k=OrdersTotal(), kp=0;

if (sy=="0") sy=Symbol();
for (i=0; i<k; i++) {
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==sy || sy==") {
if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
if (op<0 || OrderType()==op) {
if (mn<0 || OrderMagicNumber()==mn) kp++;
}}}}}
return(kp);
}

gives a lot of errors....

 
I just noticed by pure chance: I'm trading with my hands. I closed my order. slippage = 0. I look at it, it slipped by 1 point on the 5 digits. Slipped even by 0.00001)) - That's money too! Or can you steal a little bit at a time? It's not even noticeable! OK, sorry about the off-top)))
 
Alex5757000 писал(а) >>
I just noticed by accident: I am trading with my hands. I closed my order. Slippage = 0. I look at it slipped by 1 point on the 5 digits. Slipped even by 0.00001)) - That's money too! Or can you steal a little bit at a time? It's not even noticeable! OK, sorry about the off-top)))

Write it down on a piece of paper and save it, then at least in a year read what you have just written - you will have a hearty laugh :-))

 
ArtY0m >> :

Even if you just compile this function:


int NumberOfPositions(string sy="", int op=-1, int mn=-1) {
..... .....
}

gives a lot of errors....

Where do you put this function?

 
xeon >> :

Write it down on a piece of paper and save it, then at least in a year read what you have just written - you will have a hearty laugh :-))

OK, I will do so)) The thing is that I trade a lot)). I'll write it down, okay. But you still tell me what I don't understand... or what? Maybe there are some subtleties I haven't had time to learn about))) I have always thought that if slippage =0, the order must close at the requested price, otherwise the error "new prices" will appear. I clearly remember that when I clicked "close order" the price was 0.00001 points higher than the one at which the order was closed! I remember it clearly. I have a chart window with a chart_window which shows the current balance state. When I pressed "close order" my balance was one point lower than it was when the order was closed after a second - it was 1 point lower than it was when the order was closed. I don't get it, honestly...)) Or was it while I clicked the price changed by 0.00001p? Most likely...

 
Alex5757000 писал(а) >>

OK, I will do so)) The thing is, I've been trading for a while now.) I'll write it down, okay... But you still tell me what I don't understand... or what? Maybe there are some subtleties I haven't had time to learn about))) I have always thought that if slippage =0, the order must close at the requested price, otherwise the error "new prices" will appear. I clearly remember that when I clicked "close order" the price was 0.00001 points higher than the one at which the order was closed! I remember it clearly. I have a chart window with a chart_window which shows the current balance state. When I pressed "close order" my balance was one point lower than it was when the order was closed after a second - it was 1 point lower than it was when the order was closed. I don't get it, honestly...)) Or was it while I clicked the price changed by 0.00001p? Probably...

I thought you couldn't wait a year :-).

I just wanted to say that with time you will realise that these are such insignificant little things.... :-)

You may not discuss brokers here but there is a lot of information in Internet, search for it and you will get some interesting information :-)