Getting the index of the lowest close price for the last 30 Candles.

İş tamamlandı

Tamamlanma süresi: 28 dakika
Geliştirici tarafından geri bildirim
Excellent customer and developer. Thanks.
Müşteri tarafından geri bildirim
Developer was very patient and knowledgeable will definately work with The Huy Phan again

İş Gereklilikleri

I have written an EA buy I am struggling to use ILowest within a loop.

If I print out ILowest I get the correct value. But If I iterate through a loop and increase the start position of ILowest I get different values.

Surely the logic is the same for printing it out on each new candle as it is changing the start index.

I require help to work out this logic.

Basically I want to save the previous lowest candle for the last 25 candles into an arraybased on close price.

If candle[1] is the lowest array[0] = 0

if candle[2] is also lowest array[1]=0

if candle[3] is second lowest array[2]=1 

   if(!isNewBar() && InpTradeOnNewBar)
     {
      return;
     }
       
  //Something like this can be done
  ArrayResize(buyarr,30)

  buyarr[0] = ilowest(Symbol(),Period(),Mode_close,InpLookBackPeriod,1) - 1;

  //Shift values up one

   if(CopyRates(Symbol(),Period(),0,InpLookBackPeriod,BuyRates) < InpLookBackPeriod ||
      CopyRates(Symbol(),Period(),0,InpSLookBackPeriod,SellRates) < InpSLookBackPeriod)
     {
      return;
     }

   buyrank=iLowest(Symbol(),Period(),MODE_CLOSE,InpLookBackPeriod,1) - 1;
   sellrank=iHighest(Symbol(),Period(),MODE_CLOSE,InpSLookBackPeriod,1) - 1;


   
   Print(buyrank); //this prints the correct value. I would like to save this value for the previous 25 candles

   ArrayResize(buyarr,InpLookBackPeriod);

   for(int i=0; i<InpLookBackPeriod; i++)
     {
      buyarr[i] = iLowest(Symbol(),Period(),MODE_CLOSE,InpLookBackPeriod,i+1) - 1;
     }
ArrayPrint(buyarr); // This prints out totally incorrect values.

Yanıtlandı

1
Geliştirici 1
Derecelendirme
(71)
Projeler
103
20%
Arabuluculuk
6
0% / 83%
Süresi dolmuş
3
3%
Serbest
2
Geliştirici 2
Derecelendirme
(169)
Projeler
204
30%
Arabuluculuk
25
40% / 44%
Süresi dolmuş
12
6%
Serbest
3
Geliştirici 3
Derecelendirme
(74)
Projeler
121
43%
Arabuluculuk
12
33% / 50%
Süresi dolmuş
17
14%
Serbest
4
Geliştirici 4
Derecelendirme
(356)
Projeler
632
26%
Arabuluculuk
89
73% / 13%
Süresi dolmuş
12
2%
Serbest

Proje bilgisi

Bütçe
30+ USD
Geliştirici için
27 USD
Son teslim tarihi
to 1 gün