adeelpirzada:
In EA Is there any possibility to get min and max candle value given range of last x number of candles.
Using heikin ashi indicator.
or
How to get value of last x candle in EA using heikin ashi.
Thank you.
double haOpen=(ExtOBuffer[i-1]+ExtCBuffer[i-1])/2; double haClose=(open[i]+high[i]+low[i]+close[i])/4; double haHigh=MathMax(high[i],MathMax(haOpen,haClose)); double haLow=MathMin(low[i],MathMin(haOpen,haClose));
Marco vd Heijden:
Thank you for your response,
how can i fit it in with my existing code below.
//---- input parameters extern int StartHour=0; extern int SL = 50; extern int TP = 55; extern double Lots=0.1; double DepositAmount=AccountEquity(); double BalanceUsed=AccountBalance(); color color1 = Red; color color2 = White; color color3 = Red; color color4 = White; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { //---- static datetime myTime; int cmd=2; double price; int slippage=4; double stoploss; double takeprofit; color colour; int magic=1111; bool myTrades; int myTicket; for(int i=0;i<OrdersTotal();i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break; if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic) { myTrades = true; myTicket = OrderTicket(); } } if(myTrades==false) { int totlaBars = Bars; double haOpen=iCustom(NULL,0,"Heiken Ashi",color1,color2,color3,color4,2,1); //File Name of indocator. double haClose=iCustom(NULL,0,"Heiken Ashi",color1,color2,color3,color4,3,1); if(haOpen>0) { if(haOpen<haClose) { cmd=0; price=Ask; colour=Green; stoploss=Bid-SL*Point; takeprofit=Ask+TP*Point; } if(haOpen>haClose) { cmd=1; price=Bid; colour=Red; stoploss=Ask+SL*Point; takeprofit=Ask-TP*Point; } if(cmd!=2) { //int ticket=OrderSend(Symbol(), cmd, Lots, price, slippage, stoploss, takeprofit, NULL, magic, 0, colour) ; int ticket=OrderSend("EURUSD",cmd,Lots,price,slippage,stoploss,takeprofit,NULL,magic,0,colour); if(ticket<0) { Print("OrderSend failed with error #",GetLastError()); } else Print("OrderSend placed successfully"); return; } } } //---- return(0); }
Its already there.
Marco vd Heijden:
Its already there.
Its already there.
iCustom(NULL,0,"Heiken Ashi",color1,color2,color3,color4,2,1);
the value it returns does not match with current market candle values...
may be i am missing something here.
adeelpirzada:
it is not required that the value of the indicator shares the same value with the candle's.
the value it returns does not match with current market candle values...
may be i am missing something here.
//+------------------------------------------------------------------+ //| HA_buffers.mq4 | //| Copyright 2018, Marco vd Heijden, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2018, Marco vd Heijden, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict int bar=1;// bar number //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //---> create timer EventSetTimer(1); //---> ObjectCreate(0,"line",OBJ_VLINE,0,0,0); //---> return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //---> destroy timer EventKillTimer(); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //---> } //+------------------------------------------------------------------+ //| Timer function | //+------------------------------------------------------------------+ void OnTimer() { //---> string comment=""; comment=comment+"Bar Number: "+IntegerToString(bar)+"\n"; comment=comment+"Buffer 0: "+DoubleToStr(iCustom(Symbol(),PERIOD_CURRENT,"Heiken Ashi",0,bar))+"\n"; comment=comment+"Buffer 1: "+DoubleToStr(iCustom(Symbol(),PERIOD_CURRENT,"Heiken Ashi",1,bar))+"\n"; comment=comment+"Buffer 2: "+DoubleToStr(iCustom(Symbol(),PERIOD_CURRENT,"Heiken Ashi",2,bar))+"\n"; comment=comment+"Buffer 3: "+DoubleToStr(iCustom(Symbol(),PERIOD_CURRENT,"Heiken Ashi",3,bar))+"\n"; comment=comment+"Buffer 4: "+DoubleToStr(iCustom(Symbol(),PERIOD_CURRENT,"Heiken Ashi",4,bar))+"\n"; comment=comment+"Buffer 5: "+DoubleToStr(iCustom(Symbol(),PERIOD_CURRENT,"Heiken Ashi",5,bar))+"\n"; comment=comment+"Buffer 6: "+DoubleToStr(iCustom(Symbol(),PERIOD_CURRENT,"Heiken Ashi",6,bar))+"\n"; comment=comment+"Buffer 7: "+DoubleToStr(iCustom(Symbol(),PERIOD_CURRENT,"Heiken Ashi",7,bar))+"\n"; //---> Comment(comment); ObjectMove(0,"line",0,iTime(Symbol(),PERIOD_CURRENT,bar),0); //---> bar++; } //+------------------------------------------------------------------+
Marco vd Heijden:
You are amazing, this is awesome just what i wanted.
It was the buffer and time period which i couldn't get right.
Thank you.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
In EA Is there any possibility to get min and max candle value given range of last x number of candles.
Using heikin ashi indicator.
or
How to get value of last x candle in EA using heikin ashi.
Thank you.