Forex
Google
New signals service!

Go Back   Forex Trading > Discussion Areas > Metatrader 4


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

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-07-2006, 05:56 AM
Junior Member
 
Join Date: Apr 2006
Location: Boston
Posts: 8
Gavner is on a distinguished road
Need some simple help with an EA...

Hello all-
I'm new to programming and this forum, and yesterday I wrote a simple EA based on the Parabolic SAR (Buy when it's below current price, sell when it's above). I have already written trailing stops into the program, but currently it initiates a new order in the same direction that I just closed something with the trailing stop (since the SAR hasn't switched over yet). I don't want this; if the last closed trade was a sell, I want the program to wait for appropriate conditions (SAR below price) to initiate a buy, and vice versa. I'm sure there's a simple way to do this, but I can't figure it out .
Thanks a bunch in advance,
Gavner
Attached Files
File Type: mq4 SAR Cross.mq4 (4.4 KB, 41 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-07-2006, 06:06 AM
elihayun's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 350
elihayun is on a distinguished road
Quote:
Originally Posted by Gavner
Hello all-
I'm new to programming and this forum, and yesterday I wrote a simple EA based on the Parabolic SAR (Buy when it's below current price, sell when it's above). I have already written trailing stops into the program, but currently it initiates a new order in the same direction that I just closed something with the trailing stop (since the SAR hasn't switched over yet). I don't want this; if the last closed trade was a sell, I want the program to wait for appropriate conditions (SAR below price) to initiate a buy, and vice versa. I'm sure there's a simple way to do this, but I can't figure it out .
Thanks a bunch in advance,
Gavner
I think that u have to check the the SAR is blow price but also the previous SAR is above previous close price to plase a buy order. Sothing like this
// Check for BUYS
if((Ask>SARCurrent) && (iClose[1] < SARPrevious))

and the opposite for sell
// Check for SELLS
if((Bid<SARCurrent) && (iClose[1] > SARPrevious))
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SIMPLE-MACD-EA : An extremely simple EA based on 2 channels of MACD. Try it! investor_me Expert Advisors - Metatrader 4 31 07-30-2008 09:59 AM
My Simple EA Pepbullish Expert Advisors - Metatrader 4 5 02-10-2007 05:11 AM
Simple V2 polosaty Metatrader 4 2 10-17-2006 04:44 PM


All times are GMT. The time now is 07:49 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.