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

 
Vitek2010:
No it does not. I will explain - your forum is like a hope for the last competent stronghold of prog. and insertion of size - that's how the writing PERIOD_W1 sees itbut neither use of size nor use of fixed datums in the form of dates get any desired effect. I posted a specific question about Friday - by the way your code doesn't compile because it says 'version' - unknown property, so if you don't know how to put DayOfWeek and 5 (Friday's number) into the code other options won't help .


if(TimeDayOfWeek(TimeCurrent())==5)   //Пятница
 
r772ra:



Please paste your variant in my indicator code and compile it. and post the corrected indicator in clear text not as a file. Comrade Venin gave me uncompilable code and no answer.

#property indicator_separate_window

#property indicator_buffers 1

#property indicator_color1 Lime

//--------------------------------------------------------------------

double Buffer[];

//--------------------------------------------------------------------

int init()

{

SetIndexStyle(0,DRAW_HISTOGRAM, EMPTY, 2);

SetIndexBuffer(0,Buffer;)

return(0);

}

// -------------------------------------------------------------------


int deinit()

{


return(0);

}

//--------------------------------------------------------------------

int start()

{

int StartBar = Bars - IndicatorCounted() - 1;

for(int i = StartBar; i >= 0; i--)

{

if(TimeDayOfWeek(TimeCurrent())==5) //Friday

if(TimeDayOfWeek(Time[i]) < TimeDayOfWeek(Time[i+1])

Buffer[i] = 0;

else

Buffer[i] = Buffer[i+1];

if(Close[i]>Close[i+1]&&Close[i+1]>=Close[i+2]){/if both the current and previous movements are increasing

Buffer[i] += NormalizeDouble((Close[i] - Close[i+1])/Point,0);}

if(Close[i]<Close[i+1]&&Close[i+1]<Close[i+2]){// if the current and previous movement goes down

Buffer[i] += NormalizeDouble((Close[i+1] - Close[i])/Point,0);}

if(Close[i]>Close[i+1]&&Close[i+1]<Close[i+2]){//if the current move is growing and the previous one is falling

Buffer[i] += NormalizeDouble((Close[i+1] - Close[i])/Point,0);}

if(Close[i]<Close[i+1]&&Close[i+1]>=Close[i+2]){// if the current movement goes down and the previous one is going up

Buffer[i] += NormalizeDouble((Close[i] - Close[i+1])/Point,0);}

}

return(0);

}

//---------------------------------------------------------------------

 
Vitek2010:


Please paste your variant in my indicator code and compile it. and post the corrected indicator in plain text not as a file. Comrade Venin gave me an uncompilable code and didn't say a word.


build 509

//+------------------------------------------------------------------+
//|                                                    Vitek2010.mq4 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_separate_window

#property indicator_buffers 1

#property  indicator_color1 Lime

//--------------------------------------------------------------------

double Buffer[];

//--------------------------------------------------------------------

int init()

{

SetIndexStyle(0,DRAW_HISTOGRAM, EMPTY, 2);

SetIndexBuffer(0,Buffer);

return(0);

}

// -------------------------------------------------------------------



int deinit()

{



return(0);

}

//--------------------------------------------------------------------

int start()

{

int StartBar = Bars - IndicatorCounted() - 1;

for(int i = StartBar; i >= 0; i--)

{

if(TimeDayOfWeek(TimeCurrent())==5) //Пятница

Buffer[i] = 0;

else

Buffer[i] = Buffer[i+1];

if(Close[i]>Close[i+1]&&Close[i+1]>=Close[i+2]){//если текущее и преддыдущее движение растут

Buffer[i] += NormalizeDouble((Close[i] - Close[i+1])/Point,0);}

if(Close[i]<Close[i+1]&&Close[i+1]<Close[i+2]){//если текущее и преддыдущее движение падают

Buffer[i] += NormalizeDouble((Close[i+1] - Close[i])/Point,0);}

if(Close[i]>Close[i+1]&&Close[i+1]<Close[i+2]){//если текущее лвижение растет а предыдущее падает

Buffer[i] += NormalizeDouble((Close[i+1] - Close[i])/Point,0);}

if(Close[i]<Close[i+1]&&Close[i+1]>=Close[i+2]){//если текущее движение падает а предыдущее растет

Buffer[i] += NormalizeDouble((Close[i] - Close[i+1])/Point,0);}

}

return(0);

}

//---------------------------------------------------------------------
 
That's not how to define Friday on history, I don't know.
 
TarasBY:
then what does the reference to a compliant library have to do with it?


Because:

TarasBY:
Vitya, there's nothing to sort out here - the person wants global variables from one sandbox (EA with its libraries) to be visible in another sandbox(compiled library). :)))
 

Gentlemen, could you do me a favour and take a look at this piece of code and see if I have correctly entered the entry conditions for the 3 indicators.

Since I'm just learning a lot of things I don't understand.

E_ma=iMA(Symbol(),TimeFrame,period_ema,0,MODE_EMA,PRICE_CLOSE,1);
Cloce =iClose(Symbol(),PERIOD_H1,1);

e_ma=iMA(Symbol(),timeframe,period_ema,0,MODE_EMA,PRICE_CLOSE,1);
cloce =iClose(Symbol(),PERIOD_M15,1);

bbUP=iCustom(Symbol(),PERIOD_M5,"Bollinger Bands",BandsPeriod,BandsShift,BandsDeviations,1,0);
bbDOWN=iCustom(Symbol(),PERIOD_M5, "Bollinger Bands",BandsPeriod,BandsShift,BandsDeviations,2,0);

if(OrdersTotal()==0 && CountBuy()==0 && CountSell())
{
if(Cloce >E_ma && cloce >e_ma)
{
if(Ask<=bbDOWN)
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,0,0,",Magic,0,Green);
if(ticket>0)
{
TP = NormalizeDouble(Ask + TakeProfit * Point, Digits);
SL = NormalizeDouble(Ask-StopLoss * Point, Digits);
OrderModify(ticket, OrderOpenPrice(), SL, TP, 0);
}
}
else
if(Cloce <E_ma && cloce <e_ma)
{
if(Bid>=bbUP)
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,0,0,",Magic,0,Red);
if(ticket>0)
{
TP = NormalizeDouble(Bid - TakeProfit * Point, Digits);
SL = NormalizeDouble(Bid+StopLoss* Point, Digits);
OrderModify(ticket, OrderOpenPrice(), SL, TP, 0);
}
}
}


return(0);

Correct me if something is wrong, compiles without errors, but in the testor orders do not open. Because? where a mistake in the condition. How to write it correctly, I do not understand yet.someone on the fingers explain PLEASE!!!

 
r772ra:
This is all wrong, how to define Friday on the story, I don't know.

You removed the zeroing of the weekly cycle if(TimeDayOfWeek(Time[i]) < TimeDayOfWeek(Time[i+1])) and replaced it with if(TimeDayOfWeek(TimeCurrent())==5) //Friday maybe if these functions work together somehow it might work. I may have tried a hundred different things. i think it's easy to show multitime readings with weekly timeframes on lower timeframes. i still can't find a solution.

 
Vitek2010:

Yes, you removed the zeroing of the weekly cycle if(TimeDayOfWeek(Time[i]) < TimeDayOfWeek(Time[i+1])) and replaced it with if(TimeDayOfWeek(TimeCurrent())==5) //Maybe if these functions are somehow together they will work. I've probably tried hundreds of variants. i think it's easy to show multitime readings with weekly timeframe on lower timeframes. i still can't find a solution.


Here's an idea, open a new weekly bar - reset the buffer to zero, then accumulate your points
 
alsu:
Make Ticket an array Ticket[5], store all 5 tickets in it. When closing, cycle through all the tickets accordingly.

How to implement it approximately? If in other functions I seem to have understood, but with orders and arrays I don't quite have understanding yet.
 
Forexman77:
How do I roughly implement this? The other functions I'm familiar with, but with orders and arrays I don't quite have an understanding yet.

It's something like this, I guess

 // Учёт ордеров
   Symb=Symbol();                               // Название фин.инстр.
   Total=0;                                     // Количество ордеров
   int Ticket[5];
   ArrayInitialize(Ticket,0);
   for(int i=1; i<=OrdersTotal(); i++)          // Цикл перебора ордер
     {
      if (OrderSelect(i-1,SELECT_BY_POS)==true) // Если есть следующий
        {                                       // Анализ ордеров:
         if (OrderSymbol()!=Symb)continue;      // Не наш фин. инструм
         if (OrderType()>1)                     // Попался отложенный
           {
            Alert("Обнаружен отложенный ордер. Эксперт не работает.");
            return;                             // Выход из start()
           }
         Total++;                               // Счётчик рыночн. орд
         if (Total>5)                           // Было не более одного орд, стало не более пяти
           {
            Alert("Несколько рыночных ордеров. Эксперт не работает.");
            return;                             // Выход из start()
           }
         Ticket[Total-1]=OrderTicket();                  // Номер выбранн. орд.
         Tip   =OrderType();                    // Тип выбранного орд.
         Price =OrderOpenPrice();               // Цена выбранн. орд.
         SL    =OrderStopLoss();                // SL выбранного орд.
         TP    =OrderTakeProfit();              // TP выбранного орд.
         Lot   =OrderLots();                    // Количество лотов
        }
     }
   // Открытие ордеров
   while(true)                                  // Цикл закрытия орд.
     {
      if (Total < 5 && Opn_B==true)     // Открытых орд. нет +. Было Total < 1, стало Total < 5
        {                                       // критерий откр. Buy
         RefreshRates();                        // Обновление данных
         SL=Bid - New_Stop(StopLoss)*Point;     // Вычисление SL откр.
         TP=Bid + New_Stop(TakeProfit)*Point;   // Вычисление TP откр.
         Alert("Попытка открыть Buy. Ожидание ответа..");
         Ticket=OrderSend(Symb,OP_BUY,Lts,Ask,2,SL,TP);//Открытие Buy
         if (Ticket > 0)                        // Получилось :)
           {
            Alert ("Открыт ордер Buy ",Ticket);
            return;                             // Выход из start()
           }
         if (Fun_Error(GetLastError())==1)      // Обработка ошибок
            continue;                           // Повторная попытка
         return;                                // Выход из start()
        }
   // Закрытие ордеров
      if (Tip==0 && Cls_B==true)                // Открыт ордер Buy и есть критерий закр
        {
          for(i=0;i<5;i++)                             
          {
            if (Ticket[i]==0) continue;           

            Alert("Попытка закрыть Buy ",Ticket[i],". Ожидание ответа..");
            RefreshRates();                        // Обновление данных
         
            Ans=OrderClose(Ticket[i],Lot,Bid,2);      // Закрытие Buy

            if (Ans==true)                         // Получилось :)
            {
               Alert ("Закрыт ордер Buy ",Ticket[i]);
            }

            if (Fun_Error(GetLastError())==1)      // Обработка ошибок
            {
               i--;
               continue;                           // Повторная попытка
            }

         }
Reason: