Forex
Google

Go Back   Forex Trading > Programming > Metatrader Programming
Forex Forum Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


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 11-17-2007, 09:59 AM
sakkara sakkara is offline
Junior Member
 
Join Date: Nov 2007
Posts: 1
sakkara is on a distinguished road
Expert Advisor - Open Trade Issue

Hi,
I have programmed an expert advisor and is working well! It does everything I need it to do, except that there is one bug or flaw in my advisor.

I use an oscillator to get the trend, and then either open a long or short. If the trend goes the other way, it closes the current trade and opens another. This works fine, except that when back trading. One tick makes the trent up, so I open a trade. The very next tick makes the trend down, so I close the long and open a short. So on and so on, so that I actually make about 15 until the trend definately goes one way or another.

Is there any way I can somehow skip an hour's worth of ticks once I open a trade? So that I no longer trend the wrong way, etc?

Any help would be greatly appreciated!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-17-2007, 12:04 PM
demam_emas's Avatar
demam_emas demam_emas is offline
Senior Member
 
Join Date: Jan 2006
Location: Ambarawa City
Posts: 143
demam_emas is on a distinguished road
Wink

i think you should use previous bar instead current bar. Use bar index 1, not 0 for your oscillator.
Good luck
__________________
>>> $3.5 per lot Forex Cashback Let's hunt some pips!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 11-18-2007, 06:06 AM
wolfe's Avatar
wolfe wolfe is offline
Senior Member
 
Join Date: Jan 2006
Posts: 673
wolfe is on a distinguished road
Quote:
Originally Posted by demam_emas View Post
i think you should use previous bar instead current bar. Use bar index 1, not 0 for your oscillator.
Good luck
Or use previous bar And current bar.

if (current_bar > previous_bar)
{Ordersend() Long}

if (current_bar < previous_bar)
{Ordersend() Short}

Use something like that, This will stop the multiple open and close of orders in a small time frame. Plus it is using two bars to confirm the trend, instead of just one.

Just my thoughts, good luck!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make an expert advisor run other expert advisors in MQL4 activetc Metatrader 4 0 08-30-2007 04:29 AM
Need Help w/Expert Advisor cochran1 Expert Advisors - Metatrader 4 14 08-01-2007 03:55 PM
CCI Expert Advisor rodrigokaus Expert Advisors - Metatrader 4 10 09-29-2006 06:31 PM
expert advisor ? swirly Expert Advisors - Metatrader 4 3 08-30-2006 07:04 AM
What Expert Advisor are they using? fikko Expert Advisors - Metatrader 4 4 07-01-2006 08:47 AM


All times are GMT. The time now is 09:35 PM.