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

 
Can you tell me - does the for inside the for(s) work?
 
elmucon:
Can you tell me - does the for inside the for(s) work?
It works. All the other operators even work.
 
Zhunko:
It works. Even all the other operators work.

Thank you!
 
Greetings, please provide a code fragment for an Expert Advisor which uses an indicator signal for entry, which creates arrows instead of a line (i.e. the indicator style is defined as SetIndexStyle(0, DRAW_ARROW, EMPTY, 3)). I want the down arrow to sell, and the up arrow to buy. I failed using standard methods for some reason(
 

Can you tell me how to change the rsi period (default is 14)?

Thank you


//+------------------------------------------------------------------+
//|                                                  RSI_to_File.mq4 |
//|                      Copyright © 2007, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.ru/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.ru/"

#property show_inputs
string SymbolsArray[11]={"","USDCHF","GBPUSD","EURUSD","USDJPY","CHFJPY","EURGBP","EURCHF","EURJPY","GBPJPY","GBPCHF"};

//+------------------------------------------------------------------+
//| string SymbolByNumber                                   |
//+------------------------------------------------------------------+
string GetSymbolString(int Number)
  {
//----
   string res="";
   res=SymbolsArray[Number];   
//----
   return(res);
  }

//+------------------------------------------------------------------+
//| возвращает период                                                |
//+------------------------------------------------------------------+
int PeriodNumber(int number)
   {
   int per_min;
   switch (number)
      {
     
      case 5: per_min=PERIOD_H4;break;
      default: per_min=PERIOD_D1;break;
      }
   return(per_min);   
   }

//+------------------------------------------------------------------+
//|   выводит в файл котировки + значения индикатора                 |
//+------------------------------------------------------------------+
void RSI_output(string SymbolName,int PeriodMinutes)
   {
   int size=iBars(SymbolName,PeriodMinutes);
//----
   if (size==0) return;
   int handle=FileOpen(SymbolName+PeriodMinutes+"_RSI.csv",FILE_WRITE|FILE_CSV);
   if (handle<0) return;
   FileWrite(handle,"Time;RSI");
   for (int i=size-1;i>=0;i--)
      {
      FileWrite(handle,TimeToStr(iTime(SymbolName,PeriodMinutes,i))
         ,iCustom(SymbolName,PeriodMinutes,"RSI",0,i));
      }
   FileClose(handle);      
//----
   return;
   }
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
  int SymbolCounter,PeriodCounter; 
//----
   for (SymbolCounter=1;SymbolCounter<13;SymbolCounter++)
      {
      for (PeriodCounter=2;PeriodCounter<=6;PeriodCounter++)
         {
         //Print("NewBar on ",GetSymbolString(SymbolCounter),PeriodNumber(PeriodCounter),"M");
         RSI_output(GetSymbolString(SymbolCounter),PeriodNumber(PeriodCounter));
         }
      }
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

 

Guys, can you point me in the direction of registration so I can use OPLI online and get my username and password?

 
See, I got the time by the function
ObjectGet("qwerty",OBJPROP_TIME2);
I get 1323452400. As I understand the time is in seconds, so if I subtract 600 from this time, the new location will be 10 bars back on the 5 minute chart, but in fact the new coordinate has moved only 1 bar, why is this happening? And for the shift to be 10 bars you have to subtract about 3000, where is the logic here?
 

Can you tell me why I can't print variables, not even 0 pops up.

The lot controller of the respected voix_kas. Slightly reworked by me.

double GetLot(int FastPeriodMA,int SlowPeriodMA) {
int i;
static double Lot = 0;
static double PrevBalance = 0;
static double BalanceOld[0];
static double BalanceNew[0];
if (NormalizeDouble(PrevBalance - AccountBalance(), 2) != 0) {
ArrayResize(BalanceNew, ArraySize(BalanceOld) + 1);
for (i = 0; i <= ArraySize(BalanceOld) - 1; i++)
BalanceNew[i] = BalanceOld[i];
BalanceNew[ArraySize(BalanceOld)] = AccountBalance();
ArrayResize(BalanceOld, ArraySize(BalanceOld) + 1);
ArrayCopy(BalanceOld, BalanceNew);
PrevBalance = AccountBalance();

if (ArraySize(BalanceNew) > SlowPeriodMA) {
double FastMA = 0, SlowMA = 0;
for (i = ArraySize(BalanceNew) - FastPeriodMA; i <= ArraySize(BalanceNew) - 1; i++)
FastMA += BalanceNew[i];
FastMA /= FastPeriodMA;
for (i = ArraySize(BalanceNew) - SlowPeriodMA; i <= ArraySize(BalanceNew) - 1; i++)
SlowMA += BalanceNew[i];
SlowMA /= SlowPeriodMA;
if (FastMA > SlowMA){ Lot = 5;Print(" FastMA ",FastMA,"; SlowMA= ",SlowMA); } 
else Lot = 0.01;
}
}
if (Lot < MarketInfo(Symbol(), MODE_MINLOT)) Lot = MarketInfo(Symbol(), MODE_MINLOT);
else if (Lot > MarketInfo(Symbol(), MODE_MAXLOT)) Lot = MarketInfo(Symbol(), MODE_MAXLOT);
return (Lot);
}
 
001:

Can you tell me why I can't print variables, not even 0 pops up.

The lot controller of the respected voix_kas. Slightly redesigned by me.


And on every tick the size of arrays increases?

Maybe it would be easier to create a balance indicator. And in Expert Advisors one would address to it.

 
Vinin:


And at every tick the size of arrays increases?

And it might be easier to make a balance indicator. And in the Expert Advisor you would already refer to it.


You can, but the Expert Advisor works slower in this case. And with the output on the screen also nonsense turns out, it draws ONLY when the deal is closed, and how to make it exist as a continuous line of balance, I do not understand, can someone tell?
Reason: