1°)specify which Close[1] : close of EU or UC ?
2°)maybe it's better to place trade order on the openning of new canlde (candle 0) if previous one (candle 1) fulfill all conditions
//buy conditions :
bool buy_condition=(iClose("USDCHF",PERIOD_CURRENT,1) < iBands("USDCHF", PERIOD_CURRENT, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, 1) && iClose("EURUSD",PERIOD_CURRENT,1) < iMA("EURUSD", PERIOD_CURRENT, 20, 0, MODE_SMA, PRICE_CLOSE, 1));
//sell conditions
bool sell_condition=(iClose("USDCHF",PERIOD_CURRENT,1) > iBands("USDCHF",PERIOD_CURRENT,20,2,0,PRICE_CLOSE,MODE_UPPER,1) && iClose("EURUSD",PERIOD_CURRENT,1) > iMA("EURUSD", PERIOD_CURRENT, 20, 0, MODE_SMA, PRICE_CLOSE, 1));
paul selvan:
1°)specify which Close[1] : close of EU or UC ?
2°)maybe it's better to place trade order on the openning of new canlde (candle 0) if previous one (candle 1) fulfill all conditions
1. Well Ill check if the candle close above/below the bands on the UC then confirm on the EU if the price is above the middle band and take the trade on the EU
paul selvan:
//buy conditions :
Thanks will try it out
all the best

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
Im still learning alot regarding mt4 programming
Basically saw the idea regarding correlation and bolligner bands
Buy on the EUR/USD if price is below the middle line (20SMA) of the bands on the EUR/USD pair and price as crossed and closed below the lower band on the USDCHF pair
Sell on the EUR/USD if price is above the middle line (20SMA) of the bands on the EUR/USD pair and price as crossed and closed above the higher band on the USDCHF pair
Questions:
Just need to know if my logic is correct regarding my code below ?
If I state "USDCHF" and "EURUSD" inside the ibands will it check the logic on the "USDCHF"pair and place a trade on "EURUSD" if I place the EA on the EURUSD chair ?
Or this there a different approach of looking at it ?
Code:
BUY
//Open Buy Order
SELL