Forex



Go Back   Forex Trading > Discussion Areas > Metatrader 4
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 05-07-2006, 06: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, 45 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 05-07-2006, 07:06 AM
elihayun's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 397
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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 37 08-29-2009 03:57 PM
My Simple EA Pepbullish Expert Advisors - Metatrader 4 5 02-10-2007 06:11 AM
Simple V2 polosaty Metatrader 4 2 10-17-2006 05:44 PM


All times are GMT. The time now is 05:28 AM.



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