|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Request: EA code to double up lot size after a losing trade.
I want to know if there's any way to tell an EA to increase the lot size if the last trade closed in loss (martingale system), and use the normal lot size if the last trade closed in profit. It needs to be able to use micro lots. Is there any way to do this?
|
|
|||
|
I have a portion of code for a Moving Stop, but have no programming experience to make an EA out of it. Will somebody with EA creation ability kindly produce an EA with the code below?!?
Code:
total=OrdersTotal();
if(total>0){
for(cnt=0;cnt<total;cnt++){
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()==OP_BUY && OrderSymbol()==Symbol()){
if(Bid-OrderOpenPrice()>=Point*15 && Bid-OrderOpenPrice()<Point*20 && OrderStopLoss()< OrderOpenPrice()-5*Point){
OrderModify(OrderTicket(),OrderOpenPrice()-Point*5,OrderTakeProfit(),Blue);
}
if(Bid-OrderOpenPrice()>=Point*20 && OrderStopLoss()< OrderOpenPrice()){
OrderModify(OrderTicket(),OrderOpenPrice(),OrderTakeProfit(),Blue);
}
}
}
}
![]() |
|
|||
|
I will enter my system manually, I do not trust EA entry yet. I want to use EA ONLY for exit now. I feel EXIT strategy is equally (if not more) important than entry strategy. I do not like Trailing Stops, I have had much more success with STEPPED MOVING STOPS. I would love to have EA to do this for me because I have time to place trade but no time to monitor for exit. I like to backtest VISUALLY,, which is very slow but I have very specific entry criteria so it works well for me. I am currently reading Codergurus AWESOME lesson for BEGINNERS to programming MQ4: http://www.metatrader.info/node/59
Codersguru, if you are reading this thread, let me tell you man: You are a genius! I still need help making this EA. |
|
||||
|
For example:
Code:
double lot = Lots;
int ticket = GetLastOrder(Symbol(), OP_BUY, MODE_HISTORY);
if (ticket >= 0) {
OrderSelect(ticket, SELECT_BY_TICKET, MODE_HISTORY);
if (OrderProfit() > 0) lot = 2*OrderLots();
}
int GetLastOrder(string symbol, int type, int mode) {
int cnt = -1;
if (mode == MODE_TRADES) cnt = OrdersTotal(); else
if (mode == MODE_HISTORY) cnt = HistoryTotal(); else
return(-1);
int ticket = -1;
datetime dt = 0;
for (int i=0; i < cnt; i++) {
if (!OrderSelect(i, SELECT_BY_POS, mode)) continue;
if (OrderSymbol() != symbol) continue;
if (OrderMagicNumber() != Magic) continue;
if (OrderCloseTime() > dt && OrderType() == type) {
dt = OrderCloseTime();
ticket = OrderTicket();
}
}
return(ticket);
}
__________________
MQL4: idea * experience + creative solution |
|
|||
|
Traders secret Code?
anyone hear any details on Traders Secret Code by Mark Mcrae?
I've heard some good reviews, but maybe it's too new to tell if it's REALLY that good. www.traderssecretcode.com |
|
|||
|
http://www.traderssecretcode.com/
I've seen a few of his free videos he sends out as I'm on his mailing list. Nearly all of these strategies include Moving averages, basic Fibonacci retracements etc.
I don't have access to his video site though, so don't know if they are any better. I deleted the free ones I got as they were useless hindsight cherry picked trades, but if I had access to his video site I would share it. Maybe someone here has access? |
|
|||
|
i'm looking for code to make my EA trade at half volume if it trades the same direction in a pair twice in a row, i.e
if i enter GBPUSD at full volume long at 1.7500, and the next signal I see is also a GBPUSD long say at 1.7530, the second trade should be half volume, as it is rejoining a move which has already been going for a while, so the risk should be lowered. so basically i need my EA to access the record of the last closed trade on the current pair and get it's open price and whether it was a short or long position. could the above code be modified to do something like that? i've tried to do it myself but it's all a bit advanced for me thanks |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to code this? | iscuba11 | Metatrader 4 mql 4 - Development course | 1 | 08-03-2007 04:22 PM |