[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 101

 
MaxZ:

A dictionary will answer your question. And have you looked into the code at all? For how long? If it's your code, then understanding the meaning of the 10 added lines won't be difficult for you.



It worked, thank you, it's good there are people like you!
 
MaxZ:

The Force Index indicator is working perfectly. You'd better check your code written earlier.


It's a misprint, but the essence is the same) visually iForce "0" is crossed, but in fact it still trades in BUY only
 
SeALALex:

Thanks for everything, it's good there are people like you!

I'm glad you've figured it out. I'm sure you'll be helping Our Beginners soon too! :))


vilard:

I got it wrong but the essence is the same. iForce "0" crosses visually but trades BUY only
Please send me the code. But no need to write that the indicator does not work properly! :D
 
MaxZ:

I have been using the following construction for more than half a year:

The appearance of a new bar can also be checked with the Bars variable. But I'm bored with the way described above. Maybe it works faster with Bars! :D


datetime TimeLastBar;
...

int start()
{
...

if (TimeLastBar != Time[0])
{
TimeLastBar = Time[0];
...
}
}

Does the TimeLastBar variable have to be described in some special way? As a global variable?

 
I put opening in the initiation and closing in the deini, it should record every tick, but the file that is in the files directory is empty.
 
nuan:
I put opening in the initiation and closing in the deini, it should record every tick, but the file that is in the files directory is empty.
Maybe because there are no orders?
 

No, he had placed and closed five or six orders by then. I was testing in the strategy tester.

Sorry, found the mistake.

 
first_may:

Is the TimeLastBar variable to be described in some special way here? As a global variable?

Well, sort of, yes. So that its value is not cleared after exit from start(). If this causes a problem, you can describe it like this:

int start()
{
...

static datetime TimeLastBar;

if (TimeLastBar != Time[0])
{
TimeLastBar = Time[0];
...
}

...
}
:)))))))))))
 
for(int ss=0;ss<OrdersTotal();ss++)
      {
        if(OrderSelect(ss,SELECT_BY_POS)&&OrderSymbol()==Symbol()&&OrderType()==0||1)
          if(TimeCurrent()>=OrderOpenTime()+15*60)
              {
               for (int j=0; j<OrdersTotal(); j++)         // По всем ордерам
                  {
   if(OrderSelect(j,SELECT_BY_POS)==true)  // Если есть следующ.
     {                                     
      double ТР =    OrderTakeProfit();     // TakeProfit ордера
      double Profit= OrderProfit();         // Прибыль по ордеру
      double Lots  = OrderLots();           // Количество лотов
     
      //......Использование значений ТР и Profit в программе..... 
      FileWriteDouble(h,Profit,FLOAT_VALUE);
      FileWrite(h,"\n");
      
     }
                }       
              }
      }
Писать то пишет в файл но тарабарщину какую то ...
 
nuan:
I only write in pencil myself, but maybe this link will help.
Reason: