Download MetaTrader 5

open order depending current bid ak price

To add comments, please log in or register
What is MetaQuotes ID? Find that out from the article!
funkynation 2016.02.18 12:34 

hi guys im triing to open orders if a spwcified prices between highs and lows is reached, but the ea does not open orders.

the findentry and buyconditionis called every tick, can someone help me to get this snall snippet working?

ist there maybe a problem with the speed of the whole program, i have lots of loops for eg takeprofit called in the startfunction.

void findentry()
barshigh =High[iHighest(NULL,Timeframe,MODE_HIGH,5,1)];
barslow =Low[iLowest(NULL,Timeframe,MODE_LOW,5,1)];
bool buycondition()
  (NormalizeDouble(Bid,Digits) == NormalizeDouble((((barslow+barshigh/2)+barslow)/2),Digits)) &&
  (iADX(NULL,Timeframe,ADXPeriod,PRICE_MEDIAN,MODE_MAIN,1) < ADXLevel) && 
  return (false);
Keith Watford
Keith Watford 2016.02.18 13:01  
Print this out and consider if Bid is ever going to equal the result
whroeder1 2016.02.18 13:16  
barshigh =High[iHighest(NULL,Timeframe,MODE_HIGH,5,1)];
You are mixing apples and oranges
funkynation 2016.02.18 17:36  

thanks for your responses, i found the error,  @ gumrai thank you

my price calculation was completly wrong :/

this works now:


@ Whroeder

thanks for your link

concerning High and iHigh, i'm using an integer called Timeframe, that has the same value as the current open chart, its just to avoid attaching to wrong timeframes.

in my case these 2 conditions are equal when i print the values out. if i need the values from a higher timeframe i have to use iHigh.

barshigh =iHigh(NULL,Timeframe,iHighest(NULL,Timeframe,MODE_HIGH,5,1));

barshigh2 =High[iHighest(NULL,Timeframe,MODE_HIGH,5,1)];
To add comments, please log in or register