Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 463

 
wolfovik:

Can you tell me why the compiler gives the warning "expression has no effect" in the line for

Why no effect?

So do it if you don't want to just do it:

   k = 0; 
   for (i=k; i<OrdersTotal(); i++ ) {}

And you don't need i to catch up to the OrdersTotal() value - jump out of bounds. From zero you're looking for.

 
artmedia70:

So do it if you don't want to just do it:

Or even like this o_o

i = 0; 
for (;i<OrdersTotal();i++ )
 
alsu:

Or even like this o_o


Or like this for(;;)

And then like this:


 

By the way, it's not

for (i=0;i<OrdersTotal();i++ )

is not a good way to do it. Something may change during the cycle (also due to actions in the cycle itself) and you'll be screwed.

Correct

for (i=OrdersTotal()-1;i>=0;i--) {...}
 
Does anyone know if there is any way to assign hotkeys to the trend line?
 
alsu:

By the way, it's not

is not a good way to do it. Something may change during the cycle (also due to actions in the cycle itself) and you'll be screwed.

Correct


Well... we are discussing in the context of the written question. You could rewrite all the code for the questioner, of course. But that would be a disservice. But, in principle, yes - the remark should be good for him. Just make it clear that it (notice) to work with an order system, otherwise it will start to make all loops inverse :)
 
okvseok:
Does anyone know if there is any way to assign hotkeys to the trend line?
Yes, there is. But it's a one-way street.
 
borilunad:
Alexei, don't stutter(not)! Here's his question: ". how can we implement when writing an indicator so that the indicator readings on the 0th bar add up to the readings on the 1st bar?" So the first bar will fly into the sky! I don't know why he would, but I was just throwing in what can be operated on. He who seeks may find! And I learn from my mistakes, like anyone else who wants to know! ( ;)))=

Maybe I used the word "readings" wrong. By this word I meant the indicator value, i.e. the written indicator makes calculations on each bar and displays the results in a separate window as a histogram (like MACD for example). How to make the histogram columns summing up, i.e. indicator value on the 0th bar will be added to the result on the 1st bar?
 
hmpr:

I must have used the word "readings" incorrectly. By this word I meant the indicator value, i.e. the indicator I have written performs calculations on each bar and displays the results in a separate window as a histogram (like MACD, for example). How to make the histogram columns summing up, i.e. indicator value on the 0th bar will be added to the result on the 1st bar?

the example of which I will try to show you remaking it. you can do it as a text code or as a file. or post it here . because it's hard to say one recipe for all indyuks at once. the easiest solution in the Start .Buffer[i] = (more actions or a way to calculate values) if you put + you get Buffer[i] +=(.........). the summation to the previous value. in general, you need to see the basic calculation algorithm of the indicator and whether it has a period or end cycle definition etc. so the indicator and its description will help.
 

I can't solve the problem, I'm getting dull, and beer doesn't help.

I have:

1 - there are 30 EAs working on a chart or symbol and all have different Medgic number

2- Each EA has 3-5 open orders ...

The task is to print all numbers in a bar on a chart and total profit/loss on them ...

I am digging but not getting anywhere:

  #define  MagicN 0
#define  MagProf 1
 ArrayResize(mags,100,1000);ArrayInitialize(mags,0);  
   for(int f=OrdersTotal()-1; f>=0; f--)
      if(OrderSelect(f,SELECT_BY_POS))
              {
               for(int z=100-1; z>=0; z--)
                 {
                  if(mags[z][MagicN]==OrderMagicNumber())
                  mags[z][MagProf]+=OrderProfit()+OrderCommission()+OrderSwap();

                  if(mags[z][MagicN]!=OrderMagicNumber())
                    {
                     mags[z][MagicN]=OrderMagicNumber();
                     mags[z][MagProf]+=OrderProfit()+OrderCommission()+OrderSwap();
                    }
                 }
              }

Good people help who can!!! )))))))

Reason: