| / | Forum |
|
dwice1
2006.08.29 20:24
I have downloaded day trader EA and tested it with the data and it gave me promising
results.
I attached it to the chart and Mr smile is on however there is no auto trade sign. What is wrong why is it not excuting auto trade? Need help..........any kind experts:) |
|
An Expert Advisor Made to Order. Manual for a Trader Not all traders are programmers. And not all of the programmers are really good ones. So, what should be done, if you need to automate your system by do not have time and desire to study MQL4? |
|
rfiche
2006.08.29 21:30
Could you post the MQL4 code (.mql) of your EA ?
|
|
Zonker
2006.08.30 05:27
I have used that EA, it should work. Press the 'Experts' tab (along from your 'trade'
and 'account history' tabs), see if there are any error messages coming through.
|
|
bwilhiteforex
2006.08.30 18:46
Zonker wrote: I have also had problems with this. Do you have any other suggestions if we are
not getting any errors? (btw, I looked at the code and it seems okay)I have used that EA, it should work. Press the 'Experts' tab (along from your 'trade' and 'account history' tabs), see if there are any error messages coming through. BW |
|
Zonker
2006.08.31 03:47
How long are you letting it run for? It only averages two trades per 24-hours and
thats on average,.. it can go days at a time without a trade.
I added a comment for this EA in the 'code base' section. An interesting EA for someone with a little code experience who is looking for a good basic platform to hack around. You really need to understand how it exits bad trades though before you use it, least you wake up one morning to find you account completely wiped out. |
|
dwice1
2006.09.02 00:20
Here are the codes you asked for I hope they mean some sense to you. |
|
dwice1
2006.09.02 00:28
My expert tab shows day trader initialized and loaded successfully no errors so
what next?
|
|
azizan8
2008.08.13 12:06
dwice1 wrote >> My expert tab shows day trader initialized and loaded successfully no errors so what next? //+------------------------------------------------------------------+ //| DayTrading.mq4 | //| Copyright © 2005, NazFunds Company | //| http://www.nazfunds.com | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, NazFunds Company" #property link "http://www.nazfunds.com" // A reliable expert, use it on 5 min charts with 20/pips profit limit. // Do not place any stop loss. No worries, check the results extern double lots = 1.0; extern double trailingStop = 15; // trail stop in points extern double takeProfit = 20; // recomended no more than 20 extern double stopLoss = 0; // do not use s/l extern double slippage = 3; // EA identifier. Allows for several co-existing EA with different values extern string nameEA = "DayTrading"; //---- double macdHistCurrent, macdHistPrevious, macdSignalCurrent, macdSignalPrevious; double stochHistCurrent, stochHistPrevious, stochSignalCurrent, stochSignalPrevious; double sarCurrent, sarPrevious, momCurrent, momPrevious; double realTP, realSL; bool isBuying = false, isSelling = false, isClosing = false; int cnt, ticket; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { // Check for invalid bars and takeprofit if(Bars < 200) { Print("Not enough bars for this strategy - ", nameEA); return(-1); } // Calculate indicators' value calculateIndicators(); // Control open trades int totalOrders = OrdersTotal(); int numPos = 0; // scan all orders and positions... for(cnt = 0; cnt < totalOrders; cnt++) { // the next line will check for ONLY market trades, not entry orders OrderSelect(cnt, SELECT_BY_POS); // only look for this symbol, and only orders from this EA if(OrderSymbol() == Symbol() && OrderType() <= OP_SELL && OrderComment() == nameEA) { numPos++; // Check for close signal for bought trade if(OrderType() == OP_BUY) { if(isSelling || isClosing) { // Close bought trade OrderClose(OrderTicket(),OrderLots(),Bid,slippage,Violet); prtAlert("Day Trading: Closing BUY order"); } // Check trailing stop if(trailingStop > 0) { if(Bid-OrderOpenPrice() > trailingStop*Point) { if(OrderStopLoss() < (Bid - trailingStop*Point)) OrderModify(OrderTicket(), OrderOpenPrice(), Bid-trailingStop*Point,OrderTakeProfit(),0,Blue); } } } else // Check sold trade for close signal { if(isBuying || isClosing) { OrderClose(OrderTicket(), OrderLots(), Ask, slippage, Violet); prtAlert("Day Trading: Closing SELL order"); } if(trailingStop > 0) // Control trailing stop { if(OrderOpenPrice() - Ask > trailingStop*Point) { if(OrderStopLoss() == 0 || OrderStopLoss() > Ask + trailingStop*Point) OrderModify(OrderTicket(), OrderOpenPrice(), Ask + trailingStop*Point, OrderTakeProfit(), 0, Red); } } } } } // If there is no open trade for this pair and this EA if(numPos < 1) { if(AccountFreeMargin() < 1000*lots) { Print("Not enough money to trade ", lots, " lots. Strategy:", nameEA); return(0); } // Check for BUY entry signal if(isBuying && !isSelling && !isClosing) { if(stopLoss > 0) realSL = Ask - stopLoss * Point; if(takeProfit > 0) realTP = Ask + takeProfit * Point; // Buy ticket = OrderSend(Symbol(), OP_BUY, lots, Ask, slippage, realSL, realTP, nameEA, 16384,0,Red); if(ticket < 0) Print("OrderSend (",nameEA,") failed with error #", GetLastError()); prtAlert("Day Trading: Buying"); } // Check for SELL entry signal if(isSelling && !isBuying && !isClosing) { if(stopLoss > 0) realSL = Bid + stopLoss * Point; if(takeProfit > 0) realTP = Bid - takeProfit * Point; // Sell ticket = OrderSend(Symbol(), OP_SELL, lots, Bid, slippage, realSL, realTP, nameEA, 16384, 0, Red); if(ticket < 0) Print("OrderSend (",nameEA,") failed with error #", GetLastError()); prtAlert("Day Trading: Selling"); } } return(0); } //+------------------------------------------------------------------+ //| Calculate indicators' value | //+------------------------------------------------------------------+ void calculateIndicators() { macdHistCurrent = iMACD(NULL, 0, 12, 26, 9, PRICE_OPEN, MODE_MAIN, 0); macdHistPrevious = iMACD(NULL, 0, 12, 26, 9, PRICE_OPEN, MODE_MAIN, 1); macdSignalCurrent = iMACD(NULL, 0, 12, 26, 9, PRICE_OPEN, MODE_SIGNAL, 0); macdSignalPrevious = iMACD(NULL, 0, 12, 26, 9, PRICE_OPEN, MODE_SIGNAL, 1); stochHistCurrent = iStochastic(NULL, 0, 5, 3, 3, MODE_SMA, 0, MODE_MAIN, 0); stochHistPrevious = iStochastic(NULL, 0, 5, 3, 3, MODE_SMA, 0, MODE_MAIN, 1); stochSignalCurrent = iStochastic(NULL, 0, 5, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 0); stochSignalPrevious = iStochastic(NULL, 0, 5, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 1); // Parabolic Sar Current sarCurrent = iSAR(NULL, 0, 0.02, 0.2, 0); // Parabolic Sar Previuos sarPrevious = iSAR(NULL, 0, 0.02, 0.2, 1); // Momentum Current momCurrent = iMomentum(NULL, 0, 14, PRICE_OPEN, 0); // Momentum Previous momPrevious = iMomentum(NULL, 0, 14, PRICE_OPEN, 1); // Check for BUY, SELL, and CLOSE signal isBuying = (sarCurrent <= Ask && sarPrevious>sarCurrent && momCurrent < 100 && macdHistCurrent < macdSignalCurrent && stochHistCurrent < 35); isSelling = (sarCurrent >= Bid && sarPrevious<sarCurrent && momCurrent > 100 && macdHistCurrent > macdSignalCurrent && stochHistCurrent > 60); isClosing = false; } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void prtAlert(string str = "") { Print(str); Alert(str); // SpeechText(str,SPEECH_ENGLISH); // SendMail("Subject EA",str); } //+------------------------------------------------------------------+Show your code like this in future, easy for viewing and discussions. Just click button SRC, then paste it. Tq |
|
azizan8
2008.08.13 12:22
azizan8 wrote >>
Show your code like this in future, easy for viewing and discussions. Just click button SRC, then paste it. Tq The way it was programmed, sure didn't work. The programming structure is out of shape. Pls refer to this link: i) 'MQL4 Language for Newbies. Introduction' ii) MQL4 Reference
|