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.
I am learning coding using the MQL4 tutorial from Codersguru, and I'm working on "My_First_EA". It really is my first EA. It works very well, but I am trying to write a breakeven stop and I can't figure it out. The problem I have is that the breakeven stop follows the price just like a trailing stop. I would like the initial stoploss to move to keep 1 pip profit when I make 15 pips (for example), then I want the stoploss to stay at the breakeven stop (1 pip profit) until the trailing stop begins working at 25 pips profit. Then I want the trailing stop to work as usual moving every pip of profit. I think the problem might be the "OrderStopLoss()", but I don't know anything anymore. My brain is mush. Thankyou
Here is the relevent code I've done:
extern double TrailingStop=25.0;
extern double BreakEvenProfit=15;
extern double BreakEvenStop=1;
......................
my entry and open orders code here works fine
......................
for (cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderType()<=OP_SELL&&OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY)//Long position is opened
{
//should it be closed?
if (FSAR > FMA) //my exit signal
{
//----CLOSE LONG POSITION works fine
OrderClose(OrderTicket(),OrderLots(),Bid,3,Magenta );
return(0);//exit
}
////////////////////THIS IS THE PROBLEM AREA BELOW/////////
//----CHECK FOR BREAKEVEN STOP LONG POSITION------
if (Bid-OrderOpenPrice() > BreakEvenProfit*Point)
{
if (OrderStopLoss() < OrderOpenPrice()+ BreakEvenStop*Point)
{
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOp enPrice() + BreakEvenStop*Point,OrderTakeProfit(),0,Yellow);
return(0);
}
}
//-----EVERYTHING BELOW HERE WORKS AS A TYPICAL TRAILING STOP
//----check for trailing stop LONG POSITION
if(TrailingStop>0)
{
if (Bid-OrderOpenPrice()>Point*TrailingStop)
{
if (OrderStopLoss()<Bid-Point*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Yellow);
return(0);
}
}
}
}
else//go to short position
CodersGuru,
I'm looking for this. Coul you please help. Thanks.
Bongo
I’m looking for these functions:
Strategies:
1)
For trading 2 pairs: EUR/USD & USD/CHF.
If CHF/USD jump up 2 ticks, sell EUR/USD and vv
If CHF/USD jump down 2 ticks, buy EUR/USD.
If EUR/USD jump up 2 ticks, sell USD/CHF and vv
If EUR/USD jump down 2 ticks, buy USD/CHF.
2)
For trading only 1 pairs: EUR/USD.
If USD/CHF jump up 2 ticks, sell EUR/USD and vv
If USD/CHF jump down 2 ticks, buy EUR/USD but
If EUR/USD jump 2 ticks first don’t trade USD/CHF,
Wait for USD/CHF to jump first.
3)
For trading only 1 pairs: EUR/USD.
If USD/CHF jump up 2 ticks, sell EUR/USD and vv
If USD/CHF jump down 2 ticks, buy EUR/USD.
Trading on the own movement:
If EUR/USD jump up 2 ticks, buy EUR/USD,
If EUR/USD jump down 2 ticks, sell EUR/USD.
i´ve got a question: how to allow the expert to place more than one order independently?
Using the command
total=OrdersTotal();
if(total<1)
we got the control of the number of trades being executed simultaneously (if < 1, one at a tima, if >2, two at a time and so on)
But in real world, that command ends up with the expert placing two or more orders using the same entering conditions (same as using several lots).
I want to allow the expert to place another orders even if there is one or more orders opened, but not place them at thge same moment; mayba a delay form one order to other (15 or 30 min), so my question is:
HOW TO ALLOW THE EXPERT TO PLACE MORE THAN ONE ORDER, WITHOUT PLACING THEM AT ONE TIMA?
Can an EA set Parameter of an Attached Indicator ?
Hello,
i have an idea to build a system that has an EA and also visual representation of the sytem. but i have no idea how an EA can set parameter for attached indicator.
let say for if the indicator has EnableAlerts... when user set the Enable Alerts to 1 in an EA, than the attached indicator also change it's Enable Alerts Variable to 1 and vice versa..
I've got a lot of private messages asking me for helping with some pieces of code.
Here you can post your questions related to MQL4, and I'll do my best to answer them.
Hi codersguru,
First I'd like to thank you for your great posts...you really are a "coders guru"!
I would very much like to learn to write my own indicators using MQL4.
Could you please tell me how i can find all your MQL4 lessons. I tried the links within the lessons but they no longer work. I am a TOTAL newbie to all this...FX and MQL4...so your help would be greatly appreciated.
Thank you in advance
Bob