Go Back   Forex Forum > Everything Else > Rate my Software
Register FAQ Members List Calendar Chat Room Search Today's Posts Mark Forums Read
Rate my Software This is the place to discuss the many different charting software packages out there. If you need help finding the right software, then this is the place for you.

Welcome to the BabyPips.com forum!

You are currently viewing our boards as a guest which allows you to view the discussions, but prevents you from contributing. By joining our FREE community you will be able to do all of the following:

  • Post topics & responses to other discussions
  • Communicate privately with other members (PM)
  • Respond to polls
  • Upload content
  • Post comments on our blogs
  • Contribute on our Forexpedia

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.



Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-15-2008, 11:16 AM
Sweet Pip's Avatar
Sweet Pip Sweet Pip is online now
Master Contributor and Member
 

Join Date: Nov 2007
Location: BC, Canada
Posts: 370
Sweet Pip is still new to the BabyPips.com Forum
Default HELP! MT4 Expert Advisor Coding Problem

Hi,
I was wondering if anyone can help me with a problem I'm having with my EA.
When it sending an order, it's generating "Ordersend error: 130", everytime.

It seems it's either related to incorrect stop levels, or something to do with normalizing double variables.

My stop levels tp & sl are correct as far as I can tell when printing out their values, and I tried using the NormalizeDouble function, but it's still not working. Here's a snippet of code:

if (AccountBalance() < 1000) {Lots = 1; } // calculate Lot Size based on balance
else if(AccountBalance()<2000) {Lots = 2;}
else {Lots=NormalizeDouble(MathRound(AccountBalance()+1 000)/1000,Digits);}

TakeProfit1= NormalizeDouble( MathRound ( (AccountBalance()*0.04) /Lots),Digits); // calculate stop levels based on % of balance
StopLoss = NormalizeDouble(MathRound( (AccountBalance()*0.02) /Lots),Digits);
if(StopLoss <= 10){StopLoss = 11;}

if (buysignal)
{
ticket=OrderSend(Symbol(),OP_BUY,(Lots/10),Ask,3,Ask-StopLoss*Point,Ask + TakeProfit1 * Point,"Sweet Stoch EA",0,0,Green);
if(ticket>0)
{

if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES )) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
return(0); // end long order entry
}

These are the variable values:
EURJPY,M15: Lots = 0.2 Stop Loss = 11 Point = 0.01 Ask = 158.18 Take Profit = 20 Stop Loss Value = 158.07

I've tried searching the net but to no avail for a solution yet.
Thanks
__________________
Quote:
It's not always about getting what you want...it's wanting what you've got!

Last edited by Sweet Pip : 02-15-2008 at 12:32 PM.
Reply With Quote
Reply

Forex Forum > Everything Else > Rate my Software




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



All times are GMT -4. The time now is 11:10 PM.
Search Engine Optimization by vBSEO 3.0.0
"If you are aware of your weaknesses and are constantly learning, your potential is virtually limitless."
Jay Sidhu