Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.
From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.
Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
Elite Section
Get access to private discussions, specialized support, indicators and trading systems reported every week.
Advanced Elite Section
For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
Hi guys, i've been trying to figure out how to put a StopLoss.. my EA is as below,
...
Who is this CHinGsMAroonCLK ?
As I remember, this EA is nothing else than 10p3 from elCactus, but maybe I am wrong...
Check it's thread, you will probably find what you are looking for: http://www.forex-tsd.com/expert-advi...nts-3-mq4.html
What I am trying to do is have a comment on the chart and in the journal stating which entry condition was used to open the current position.
Has this been done before and how do you do it because I have been trying for a while now but no luck and it's not as easy as I thought.
Below is my latest attempt.
any help would be great
buysig = Long || Long2 || Long3 || Long4;
sellsig = Short || Short2 || Short3 || Short4;
closebuy=sellsig;
closesell=buysig;
if (curprof>=AccountEquity()*ProfitExit/100.0) {
exit=true;
}
if (last>0 && (Time[0]-last)/(Period()*60)>=CancelOrderBars) {
remorder=true;
}
}
void CheckForOpen() {
int res,tr;
//---- sell conditions
co=CalculateCurrentOrders(Symbol());
if(sellsig && lastsig!=-1) {
if ( Short == true)Print(" Short signal taken ");
if ( Short2 == true)Print(" Short2 signal taken ");
if ( Short3 == true)Print(" Short3 signal taken ");
if ( Short4 == true)Print(" Short4 signal taken ");
co=CalculateCurrentOrders(Symbol());
if (co==0) {
res = OpenStop(OP_SELLSTOP,LotsRisk(StopLoss), Low[shift]-OrderPipsDiff*Point, StopLoss, TakeProfit1);
}
lastsig=-1;
last=Time[0];
return;
}
//---- buy conditions
co=CalculateCurrentOrders(Symbol());
if(buysig && lastsig!=1) {
if ( Long == true) Print(" Long signal taken ");
if ( Long2 == true)Print(" Long2 signal taken ");
if ( Long3 == true) Print(" Long3 signal taken ");
if ( Long4 == true)Print(" Long4 signal taken ");
co=CalculateCurrentOrders(Symbol());
if (co==0) {
res = OpenStop(OP_BUYSTOP,LotsRisk(StopLoss), High[shift]+OrderPipsDiff*Point, StopLoss, TakeProfit1);
}
last=Time[0];
lastsig=1;
return;
}
}
bool CloseAtMarket(int ticket,double lot) {
//fault tolerant market order closing
bool bres=false; int tr;
tries=0;
while (!bres && tries<OrderTriesNumber) {
RefreshRates();
bres=OrderClose(ticket,lot,OrderClosePrice(),slipp age,White);
tries++;
tr=0; while (tr<5 && !IsTradeAllowed()) { tr++; Sleep(2000); }
}
if (!bres) Print("Error closing order : ",ErrorDescription(GetLastError()));
}
int OpenStop(int mode,double lot, double prc, int SL, int TP) {
int res,tr,col;
string mail;
double openprice,sl,tp,stlev;
tries=0;
stlev=(1+MarketInfo(Symbol(),MODE_STOPLEVEL))*Poin t;
while (res<=0 && tries<OrderTriesNumber) {
tr=0; while (tr<5 && !IsTradeAllowed()) { tr++; Sleep(2000); }
RefreshRates();
if (mode==OP_SELLSTOP) {
if (prc<=Bid-stlev) openprice=prc;
else openprice=Bid-stlev;
if (SL>0) sl=openprice+SL*Point;
if (TP>0) tp=openprice-TP*Point;
col=Red;
} else
if (mode==OP_BUYSTOP) {
if (prc>=Ask+stlev) openprice=prc;
else openprice=Ask+stlev;
if (SL>0) sl=openprice-SL*Point;
if (TP>0) tp=openprice+TP*Point;
This EA wont even compile, stoploss should be the lest of your concerns. There are 5 Variables that have random spaces in them or the first letter isn't capitalized!
This EA wont even compile, stoploss should be the lest of your concerns. There are 5 Variables that have random spaces in them or the first letter isn't capitalized!
Here the fix version.
But this still can't open any position because there is no logic in the code for decide how to open long / short positions.
I would like to ask how to make an ea draw a simple line in the chart-window (like a TrailingStop). I don´t want an indikator, just the ea itself (MT4).
Is this possible?
Who is this CHinGsMAroonCLK ?
As I remember, this EA is nothing else than 10p3 from elCactus, but maybe I am wrong...
Check it's thread, you will probably find what you are looking for: http://www.forex-tsd.com/expert-advi...nts-3-mq4.html
Ok.. so now the thing is i can'y put a stoploss for this EA.. whats the code? can help me? thanx
I trying to tweak a code but after much effort I still couldn't get it right.. if any of you guys dont mind can you have a look at this.. appreciate..
The idea is to stop the next trade if the price range is in the same zone as the previous trade. Long trade will check zone for last OPEN POSITION long trade, and short trade will check zone for last OPEN POSITION short trade.
ie. if the first LONG at 1.4000, then the second LONG will only trigger if the price move out of the zone (20 pips zone) less than 1.3990 && more than 1.4010
Thanks everyone..
//+------------------------------------------------------------------------------------------------------------------------+
//| Filter for sideways market - preventing multiple trade in similar price range and create no-trade zone |
//+------------------------------------------------------------------------------------------------------------------------+
extern int Zone1 = -10; // (lower zone)
extern int Zone2 = 10; // (upper zone)
// no trade zone between -10 and +10 from the previous trade
bool CheckZone(int type)
{
int cnt = OrdersTotal();
for (int i=0; i < cnt; i++)
{
if (!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue;
if (OrderSymbol() != Symbol()) continue;
if (OrderMagicNumber() != Magic) continue;
Please check the following code and tell me why this is not placing the trades at my demo account. Its good EA on GJ 1m but unfortunately its not working. Can anyone fix it please and make it usable as a bug free EA.
I am thankfully in advance!
Best Regards.
//+------------------------------------------------------------------+
extern int Length1 = 3;
extern int Length2 = 10;
extern int Length3 = 16;
double Histo[];
double MaHisto[];
double up[];
double dn[];
double upMode[];
double dnMode[];
int alertBar;
int init()
{
return(0);
}
int deinit()
{
return(0);
}
int start()
{
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars<0) counted_bars=0;
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
Please check the following code and tell me why this is not placing the trades at my demo account. Its good EA on GJ 1m but unfortunately its not working. Can anyone fix it please and make it usable as a bug free EA.
I am thankfully in advance!
Best Regards.
//+------------------------------------------------------------------+
extern int Length1 = 3;
extern int Length2 = 10;
extern int Length3 = 16;
double Histo[];
double MaHisto[];
double up[];
double dn[];
double upMode[];
double dnMode[];
int alertBar;
int init()
{
return(0);
}
int deinit()
{
return(0);
}
int start()
{
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars<0) counted_bars=0;
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
"OrderSend(Symbol(),OP_SELL,0.1,Ask,3,25,15,0,0,0, R ed); "
You are selling at the Ask price, should be Bid.
The Comment field should be "", not 0.
25 as SL should be Bid+25*Point.
15 as TP should be Bid-15*Point.
"R ed" is not a color.
"OrderSend(Symbol(),OP_SELL,0.1,Ask,3,25,15,0,0,0, R ed); "
You are selling at the Ask price, should be Bid.
The Comment field should be "", not 0.
25 as SL should be Bid+25*Point.
15 as TP should be Bid-15*Point.
"R ed" is not a color.
Thank you very much for your support!
But, I am still facing problems zero knowledge of MQL. Can you please copy paste the code in mq4 file and test it on demo and then tell me if it works fine. Your support will be counted as Kindest Help Michel.