Why doent this work?!?

 

In my mind this should work. But i get so many errors...

Im trying to find the highest candle from current time to when i entered the deal.


double Start;

   double TimeCurrent;

   double HighestCandel;

   double High[];

   

  

   if (HistorySelect(0, TimeTradeServer()) && (HistoryDealsTotal() > 0))

    Start=(string)HistoryDealGetInteger(HistoryDealGetTicket(HistoryDealsTotal() - 1), DEAL_ENTRY);

    

   

   ArraySetAsSeries(High,true);

   CopyHigh(const string ,PERIOD_CURRENT,TimeCurrent,Start,High&[]); This is the part that isnt working.

   HighestCandel= ArrayMaximum(High,NuTid,Start);

   

   Comment ("Highest candel 1-Start: ",HighestCandel);

   

     


 
  1. When you post code please use the CODE button (Alt-S)! (For large amounts of code, attach it.) Please edit your post.
              General rules and best pratices of the Forum. - General - MQL5 programming forum
              Messages Editor

  2. CopyHigh(const string ,PERIOD_CURRENT,TimeCurrent,Start,High&[]); This is the part that isnt working.
    It doesn't work because that line doesn't even compile.


 
Tweeker:

In my mind this should work. But i get so many errors...

Im trying to find the highest candle from current time to when i entered the deal.


   double Start;

   double TimeCurrent;

   double HighestCandel;

   double High[];

The variables Start and TimeCurrent can't be double. They must be datetime or int. See the documentation for CopyHigh(): https://www.mql5.com/en/docs/series/copyhigh

Documentation on MQL5: Timeseries and Indicators Access / CopyHigh
Documentation on MQL5: Timeseries and Indicators Access / CopyHigh
  • www.mql5.com
The function gets into high_array the history data of highest bar prices for the selected symbol-period pair in the specified quantity. It should be noted that elements ordering is from present to past, i.e., starting position of 0 means the current bar. If you know the amount of data you need to copy, it should better be done to a statically...
 
Tweeker:

I have done this to the code. I get the highest of the last two candels but not since i started the deal.


If candle five whas biggest the comment says "MFE=1.0"

If the current candle is highest the comment says "MFE=0.0"


Please help.


Is there anyway to get the comment to say what the highest price whas and not only the highest candel?

void OnTick()
  {
  
   int Start;
   double HighestCandel;
   double High[];
   
  
   
  
   if (HistorySelect(0, TimeCurrent()) && (HistoryDealsTotal() > 0))
    Start= (string)HistoryDealGetInteger(HistoryDealGetTicket(HistoryDealsTotal() - 1), DEAL_TIME);
    
 
   
   ArraySetAsSeries(High,true);
   CopyHigh(_Symbol,PERIOD_M1,0,DEAL_TIME,High);
   HighestCandel= ArrayMaximum(High,0,Start);
   
   Comment ("MFE: ",HighestCandel);
     

  }

   

     


Reason: