basic ea need help

The forum for experienced coders to upload their helpful hints, tips and lessons.
Post Reply
OldTrader
Trader
Posts: 71
Joined: Wed Nov 16, 2011 10:19 pm

basic ea need help

Post by OldTrader »

I am playing with a very basic ea, however there is one thing I can't seem to figure out
how to allow for multiple orders same direction.
I have trade conditions set and working, but every once in awhile I will get a second entry condition whilst still in a trade. I'd like to allow it to open these trades (stack).
I cannot see in the code where it specifically disallows this, but I am very newb to code.

This is the ea I made using an online code generator. It's just for me to learn and to hopefully try out some basic ideas, but this little obstacle has me thrown already. Anyone willing to help?
Thanks
Last edited by OldTrader on Fri Feb 20, 2015 2:27 am, edited 1 time in total.
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

basic ea need help

Post by SteveHopwood »

OldTrader » Thu Feb 19, 2015 9:31 pm wrote:I am playing with a very basic ea, however there is one thing I can't seem to figure out
how to allow for multiple orders same direction.
I have trade conditions set and working, but every once in awhile I will get a second entry condition whilst still in a trade. I'd like to allow it to open these trades (stack).
I cannot see in the code where it specifically disallows this, but I am very newb to code.

This is the ea I made using an online code generator. It's just for me to learn and to hopefully try out some basic ideas, but this little obstacle has me thrown already. Anyone willing to help?
Thanks
Your chances of arousing the interest of a coder here in something you generated online are as close to zero as anything can get.

EA coders populate their code with explanatory comments so that when they revisit their code several months later and have totally forgotten what it was they coded (guess how I know) they can start to rebuild a picture of what it is they coded. Actually, I am rubbish at this but that is another story.

Online code generators do not include such commentary. So your code is unreadable. There may be noob coders here anxious to make an impact here by helping you out. The rest of us are not interested.

You might be better off presenting the results of several months of live manual trading, then asking one of the brilliant coders to write an ea. We have quite a decent track record here. Unlike you.

:xm:
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.
OldTrader
Trader
Posts: 71
Joined: Wed Nov 16, 2011 10:19 pm

basic ea need help

Post by OldTrader »

whatever you say boss
dietcoke
Trader
Posts: 162
Joined: Tue Nov 15, 2011 9:59 pm

basic ea need help

Post by dietcoke »

The problem is here in line 43/44 for longs. There is a similar situation later on for shorts

Code: Select all

		OrderSelect(LongTicket,SELECT_BY_TICKET);
		if(OrderCloseTime() != 0 || LongTicket == 0)

basically if

Code: Select all

OrderSelect(LongTicket,SELECT_BY_TICKET);
returns a ticket number, then the ea will not look for new trades.


The line is there to prevent the EA constantly opening trades. To implement stacking, you will need to change code so that rather than looking at the currently open trades, it looks for new trades once per bar at the start of the bar.
Image
OldTrader
Trader
Posts: 71
Joined: Wed Nov 16, 2011 10:19 pm

basic ea need help

Post by OldTrader »

thank you dc, that allows me to understand why it doesn't, so i will continue searching for the answer on how to code it the way you've described. appreciate the time
Post Reply

Return to “Coding Lessons - info for all”