Ric
Need advise on this code
-
fxcba
- Trader
- Posts: 46
- Joined: Wed Aug 21, 2013 10:10 pm
Need advise on this code
Thank you for your help Steve, have a nice weekend 
Ric
Ric
-
fxcba
- Trader
- Posts: 46
- Joined: Wed Aug 21, 2013 10:10 pm
Need advise on this code
Hello
This is an EA I recoded mixing 2 EAs, both were downloaded from mql5 data base, given my little knowledge I'm pretty sure code is a mess, but it looks functional, I'm facing two problems and I wonder if any of you can take a look.
First issue is not placing buy stop order at right level , it seems sell stop order it's ok, b ut please check it out.
Second after placing the orders it fails setting SL and TP.
Logic of this EA is to put 2 pending orders at previous H and L minus/plus buffer pips at predeterminated time.
Original EAs work fine individually, so I'm pretty sure that with a little tweak its going to work.
Ric
This is an EA I recoded mixing 2 EAs, both were downloaded from mql5 data base, given my little knowledge I'm pretty sure code is a mess, but it looks functional, I'm facing two problems and I wonder if any of you can take a look.
First issue is not placing buy stop order at right level , it seems sell stop order it's ok, b ut please check it out.
Second after placing the orders it fails setting SL and TP.
Logic of this EA is to put 2 pending orders at previous H and L minus/plus buffer pips at predeterminated time.
Original EAs work fine individually, so I'm pretty sure that with a little tweak its going to work.
Ric
You do not have the required permissions to view the files attached to this post.
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Need advise on this code
Lok at lines 111-113.fxcba » Thu Sep 18, 2014 6:47 pm wrote:Hello
This is an EA I recoded mixing 2 EAs, both were downloaded from mql5 data base, given my little knowledge I'm pretty sure code is a mess, but it looks functional, I'm facing two problems and I wonder if any of you can take a look.
First issue is not placing buy stop order at right level , it seems sell stop order it's ok, b ut please check it out.
Second after placing the orders it fails setting SL and TP.
Logic of this EA is to put 2 pending orders at previous H and L minus/plus buffer pips at predeterminated time.
Original EAs work fine individually, so I'm pretty sure that with a little tweak its going to work.
Ric
Code: Select all
// Calculate stop loss
double slb=NormalizeDouble(Ask-SL*Point,Digits);
double sls=NormalizeDouble(Bid+SL*Point,Digits);The snippet of code at 143-151 omits a check for the chart symbol, so any trade open on the chart with the same magic number will stop the upcoming pending trade. You will find the correct way of iterating through the list of trades correctly in any one of the hundreds of ea's I have posted here and elsewhere. Look in CountOpenTrades() in my shells, or FB, or...............................
If an order send/modify fails, there is no error checking to report back why. Granted, the report back is often useless rubbish, but that is CrapQLx for you. At least with error checking, you know there was a blunder in the code.
double CheckForModify() isn't even called; at least CrapQL4 informed the coder of such redundant functions.
Basically, this code is rubbish and you would be better off starting from scratch and writing your own. If nothing else, you would learn how to code.
Read the effing manual, ok?
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
-
fxcba
- Trader
- Posts: 46
- Joined: Wed Aug 21, 2013 10:10 pm
Need advise on this code
Hey Steve, thank you buddy, explained is better
and messing with other's code is helping to learn.
Cheers
I know, and I'm doing another ea this way alreay (I've downloaded your shell ea)but progress is slowBasically, this code is rubbish and you would be better off starting from scratch and writing your own. If nothing else, you would learn how to code.
Cheers
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Need advise on this code
Up an at 'em, Tiger.fxcba » Thu Sep 18, 2014 10:48 pm wrote:Hey Steve, thank you buddy, explained is better![]()
I know, and I'm doing another ea this way already (I've downloaded your shell ea)but progress is slowand messing with other's code is helping to learn.
Cheers
Where you are right now, a lot of the so-called 'Help' accessed via the F1 key probably reads like garbage. For sure, it is not written by anybody who really understands this stuff and so can write help in such a way that inexperienced coders can understand it. They should team up with Microsoft and work at producing so-called 'help' that does not even resemble a written language.
The better you get at this stuff, the easier it becomes to understand the claptrap. There is no shortcut for us normal people (I do not count anybody with a computer science degree as 'normal' - sorry guys but you are just plain weird); we just have to do the hard gazillions of miles until we start to understand it all.
Keep going. You will not be sorry. Guess how I know?
Read the effing manual, ok?
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
-
Cheeter
- Posts: 7
- Joined: Tue Aug 21, 2012 10:26 pm
Need advise on this code
Hi I am getting an error on the first line. If some one could help would be very appreciated.
Thank you Cheeter
Thank you Cheeter
Code: Select all
void delete(int type){
if(OrdersTotal()>0){
for(i=OrdersTotal()-1;i>=0;i--){
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(type!=6 && type!=7 && type!=8)if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderType()==type)OrderDelete(OrderTicket());
if(type==6)if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderType()==OP_BUYSTOP || OrderType()==OP_SELLSTOP || OrderType()==OP_BUYLIMIT || OrderType()==OP_SELLLIMIT)OrderDelete(OrderTicket());
if(type==7)if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderType()==OP_BUYSTOP || OrderType()==OP_BUYLIMIT)OrderDelete(OrderTicket());
if(type==8)if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderType()==OP_SELLSTOP || OrderType()==OP_SELLLIMIT)OrderDelete(OrderTicket());
}
}
}- milanese
- TechAdmin
- Posts: 3293
- Joined: Wed Jan 09, 2013 9:02 am
- Location: btr rdx, r8 +
Need advise on this code
try this:Cheeter » Fri Oct 03, 2014 5:58 pm wrote:Hi I am getting an error on the first line. If some one could help would be very appreciated.
Thank you Cheeter
Code: Select all
void delete(int type){ if(OrdersTotal()>0){ for(i=OrdersTotal()-1;i>=0;i--){ OrderSelect(i,SELECT_BY_POS,MODE_TRADES); if(type!=6 && type!=7 && type!=8)if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderType()==type)OrderDelete(OrderTicket()); if(type==6)if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderType()==OP_BUYSTOP || OrderType()==OP_SELLSTOP || OrderType()==OP_BUYLIMIT || OrderType()==OP_SELLLIMIT)OrderDelete(OrderTicket()); if(type==7)if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderType()==OP_BUYSTOP || OrderType()==OP_BUYLIMIT)OrderDelete(OrderTicket()); if(type==8)if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderType()==OP_SELLSTOP || OrderType()==OP_SELLLIMIT)OrderDelete(OrderTicket()); } } }
Code: Select all
void delete_function(int type){
if(OrdersTotal()>0){
for(int i=OrdersTotal()-1;i>=0;i--){
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(type!=6 && type!=7 && type!=8)if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderType()==type)OrderDelete(OrderTicket());
if(type==6)if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderType()==OP_BUYSTOP || OrderType()==OP_SELLSTOP || OrderType()==OP_BUYLIMIT || OrderType()==OP_SELLLIMIT)OrderDelete(OrderTicket());
if(type==7)if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderType()==OP_BUYSTOP || OrderType()==OP_BUYLIMIT)OrderDelete(OrderTicket());
if(type==8)if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderType()==OP_SELLSTOP || OrderType()==OP_SELLLIMIT)OrderDelete(OrderTicket());
}
}
}Cheers
Tommaso
Global Prime is the official SHF broker 
Searching for Servers and Workstations with individual configuration?
Just PM
Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
Searching for Servers and Workstations with individual configuration?
Just PM
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
-
Cheeter
- Posts: 7
- Joined: Tue Aug 21, 2012 10:26 pm
Need advise on this code
Thank you Tommaso that did the trick. cheeter
-
fxcba
- Trader
- Posts: 46
- Joined: Wed Aug 21, 2013 10:10 pm
Need advise on this code
Hello, code-mastersfxcba » Thu Sep 18, 2014 3:47 pm wrote:Hello
This is an EA I recoded mixing 2 EAs, both were downloaded from mql5 data base, given my little knowledge I'm pretty sure code is a mess, but it looks functional, I'm facing two problems and I wonder if any of you can take a look.
First issue is not placing buy stop order at right level , it seems sell stop order it's ok, b ut please check it out.
Second after placing the orders it fails setting SL and TP.
Logic of this EA is to put 2 pending orders at previous H and L minus/plus buffer pips at predeterminated time.
Original EAs work fine individually, so I'm pretty sure that with a little tweak its going to work.
Ric
I've managed to make this bot run, well, is crawling yet, but I'm closer. I want the ea
1º- send two pending orders (done)
2º- send orders at specified time (done)
3º- orders with SL and TP (done)
4º- the pending orders have to be at certain distance from high and low of previuos hour candle (fail)
I'm having trouble with this.
EA reads the distance and send orders but not adding at previous hour high nor subtracting the previous hourly low.
Any hint would be appreciated.
Dear Steve I'm still strugling with your shell ea, I didn't get it yet
Cheers Ric
-
Lowphat
- Trader
- Posts: 121
- Joined: Fri Jun 27, 2014 12:20 am
Need advise on this code
MyPoint=Point*10
(Low[1]-spread*MyPoint)-(pointsPastLow*MyPoint)
(Low[1]-spread*MyPoint)-(pointsPastLow*MyPoint)