You are right, it seems that there is a problem with the calculation of the bidPrice and the lowestValue
for Sell_Condition_1bool Sell_Condition_1 = (bidPrice<lowestValue)
if you test the code for 03.01.2013 till 05.01.2013
on 201301.04 13:34:00 bidPrice:1.30068
lowestValue:1.30022
Diferrence:0.000460000000000127
on 2013.01.04 13:35:00 bidPrice:1.30009
lowestValue:1.30009
Diferrence:0.0
on 2013.01.04 13:36:00 bidPrice:1.29994
lowestValue:1.29973
Diferrence:0.0002099999999998214
the lowestValue is always lower than the bidPrice
the bidPrice is set
double bidPrice = SymbolInfoDouble(Symbol(),SYMBOL_BID);
the lowestPrice is set
CopyHigh(_Symbol,PERIOD_M30,i,open_back_periods,h); CopyLow(_Symbol,PERIOD_M30,i,open_back_periods,l); int highIndex = ArrayMaximum(h,0,WHOLE_ARRAY); //Print("highIndex:",highIndex); double highestValue=NormalizeDouble(h[highIndex],_Digits); int lowIndex = ArrayMinimum(l,0,WHOLE_ARRAY); //Print("lowIndex:",lowIndex); double lowestValue=NormalizeDouble(l[lowIndex],_Digits);
if I change the Sell_Condition_1
(bidPrice=lowestValue)
the EA places sell and buy orders
Thanks for your help
...
This condition for buy isn't right :
bool Buy_Condition_1=(askPrice>highestValue); // MA-8 Increasing upwards
Your highestValue is calculated on Bid price and then you compare ask price and bid price. This wrong condition explains why you get buy trade. If you correct it, you don't get any trade.
Obviously, your conditions are
bool Buy_Condition_1 = (bidPrice>highestValue) (if corrected) and bool Sell_Condition_1 = (bidPrice<lowestValue)
These condition are always false, as you calculate the lowest low and highest high from current time to 9 periods back. The bid price is at best the lowest or the highest but cant' be lower than the lowest or higher than the highest price.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use