- 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 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.
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](https://c.mql5.com/36/16/documentation-on-mql5-timeseries.png)
- www.mql5.com
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); }
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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);