logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
jer99  
#1 Posted : Wednesday, June 10, 2009 5:49:04 PM(UTC)
jer99

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2006(UTC)
Posts: 33

I would like to have my EA show a buy arrow the first time a condition is met until a second condition appears. For example:

Condition 1 (Buy)

mov(c,12,s) > mov(c,24,s) and rsi(14) > 60

Condition 2 (sell)

mov(c,24,s) > mov(c,12,s) and rsi(14) < 60

I would like to see one arrow the first time a buy or sell is done and then when the opposite condition exists, the other arrow. But only once.

I tried placing the above logic into an EA and got multiple Buys/Sells.

I understand why that happened - I'm used to writting code in a linear fashion like:

if condition1 and not flag1

then

flag1 = true

place arrow

end if

but the environment is different and am having a tough time with this type of logic.

wabbit  
#2 Posted : Wednesday, June 10, 2009 7:47:17 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Search the forum for "latches" or "latching", also have a look in the forum.dll for the latch function, or read Roy Larsen's excellent guide to writing latches which can be found in the files section of the forum.


wabbit [:D]

jer99  
#3 Posted : Thursday, June 11, 2009 4:00:18 PM(UTC)
jer99

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2006(UTC)
Posts: 33

thanks wabbitt.

I forgot about that - I did a search and found I asked the same question a while back. I took a hiatus from the forum..and I forgot a lot.

;-)

Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.