Hi, Next time please use SRC button to put your code in this forum
In your code, you must use Bid instead Ask
if( Variable_1 < Variable_2 && MarketInfo(Symbol(), MODE_ASK) <= PriceTargetWhereIWantToSell ) { Alert("Target Hit"); PosSizeShort = 5; OpenShorts = OpenShorts + PosSizeShort; RefreshRates(); int TICKET = OrderSend(Symbol(), OP_SELL, (double)PosSizeShort, Bid, 5, GoalLongs, GoalShorts); if(TICKET < 0) Alert("order failed: error #", GetLastError()); else Alert("Order placed succesfully"); }
Have a look there, maybe want you intent to do :
EES Hedger - Take the other side of the trade - buy when you are selling, sell when you are buying - expert for MetaTrader
https://www.mql5.com/en/code/8320
EES Hedger - Take the other side of the trade - buy when you are selling, sell when you are buying
- votes: 4
- 2008.08.22
- eesfx
- www.mql5.com
Do you have the need to take the opposite side of a trade? Using manual trading or another EA, EES Hedger can immediately take the opposite position as specified in EA parameters. Instructions: For example, you are trading SAR EA on GBPUSD and SAR
Can someone tell me just what's going on with my GPS Robot I installed it more than (2) weeks ago everything seems in order but to this day it has not placed 1 trade is this the norm? or this thing is playing games with me?
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
the following is in MQL4!!!
so i have been programming my code and i have been constantly getting error code 129. i don't know how to fix it
also:
the Alert("Target Hit") comes WAY after my price target hit, way to delayed.:
if(Variable_1 < Variable_2 && MarketInfo(Symbol(), MODE_ASK) <= PriceTargetWhereIWantToSell)
{
Alert("Target Hit");
PosSizeShort = 5;
OpenShorts = OpenShorts + PosSizeShort;
RefreshRates();
int TICKET = OrderSend(Symbol(), OP_SELL, (double)PosSizeShort, Ask, 5, GoalLongs, GoalShorts);
if(TICKET < 0)
{Alert("order failed: error #", GetLastError());}
else{Alert("Order placed succesfully");}
}
can someone please help its important