Forex



Go Back   Forex Trading > Training > Metatrader > Metatrader 4 mql 4 - Development course > Questions
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
  #601 (permalink)  
Old 05-31-2007, 09:44 PM
Senior Member
 
Join Date: Feb 2006
Posts: 587
Michel is on a distinguished road
When you scan the orders collection by the "for" loop, you have to check if the selected order is on the current symbol, otherwize you will quickly do some greek salad...

PHP Code:
  for (int i=0i<OrdersTotal(); i++) {
    if (
OrderSelect(iSELECT_BY_POSMODE_TRADES)) {
      if(
OrderSymbol()==Symbol()) TrailingPositions();
    } 

Last edited by Michel; 05-31-2007 at 09:46 PM.
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
  #602 (permalink)  
Old 05-31-2007, 10:18 PM
basza's Avatar
Senior Member
 
Join Date: Dec 2005
Posts: 161
basza is on a distinguished road
Percentage code ?

Hello

Could someone please show me what code I need to show a percentage value of the account balance within an EA.

Thanks in advance
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
  #603 (permalink)  
Old 06-04-2007, 02:02 AM
Senior Member
 
Join Date: Nov 2006
Posts: 237
teldon is on a distinguished road
multiple entries

hi, how to code multiple entires eg.....

// check for long position (BUY) possibility
if ( Macd3 > Macd2 && Macd2 < Macd1 && Macd2 < -0.0045 )
if ( Macd3 > Macd2 && Macd2 < Macd1 && Macd2 < -0.0030 )
if ( Macd3 > Macd2 && Macd2 < Macd1 && Macd2 < -0.0015 )


I ran through the strategy tester and no trades opened but i deleted the 2 lines below and it was fine , please advise..
thx
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
  #604 (permalink)  
Old 06-04-2007, 02:15 AM
ryanklefas's Avatar
Senior Member
 
Join Date: Apr 2006
Location: USA
Posts: 438
ryanklefas is on a distinguished road
Quote:
Originally Posted by basza
Hello

Could someone please show me what code I need to show a percentage value of the account balance within an EA.

Thanks in advance
This code is taken directly from one of my EAs:

PHP Code:
double balanceDeviation()
{

   
double equit AccountEquity();
   
double bal AccountBalance();
   
   
double val = ((equit/bal) -1) * 100;
   
   return (
val);

__________________
"Don't work harder, work smarter." -- my Java professor

Advertise on The All New FireCell Network
"Where online investing makes sense"

Coder for Hire:
http://firecell.info
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
  #605 (permalink)  
Old 06-04-2007, 05:49 AM
elitecamper's Avatar
Senior Member
 
Join Date: May 2007
Posts: 132
elitecamper is on a distinguished road
hey guys hows it going
i have a quick question, is there any why of converting an mq4 file into a .DLL file? i need an mq4 indicator in converted into a .DLL indicator in C+ or C. would it be hard for a programmer to write a converter? if not then ill look into hiring a coder.
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
  #606 (permalink)  
Old 06-05-2007, 06:54 PM
Junior Member
 
Join Date: Jan 2007
Posts: 4
scardi is on a distinguished road
A question from a newbie

Hi guys,
Often, when I try to modify a mq4 file with MetaEditor, I get the message “Access is denied” and I cannot modify the file. How do you guys deal with such a problem? Thanks! scardi
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
  #607 (permalink)  
Old 06-06-2007, 11:39 PM
proverbs's Avatar
Member
 
Join Date: Jan 2007
Posts: 73
proverbs is on a distinguished road
Code Question

Please disregard post. This setting did what I needed it to do. Thanks for begin there to help us.

I have modified an EA to work with several methods. I have done some research but can not figure out how to add the name of the EA to the comments field when opening an order. Can someone please point me in the right direction.

I am hoping there is a simple string command that I can integrate into any EA I modify so that the orders are better organized when running more than one EA during a test.

Thanks for your time and insight.

OrderComment.JPG

Here is one of the non-modified sections I will need to change to input the EA comment.

Code:
   if(ObjectFind(BuyStop_TrendName) == 0)
     {
       SetObject("Active" + BuyStop_TrendName,
                 ObjectGet(BuyStop_TrendName, OBJPROP_TIME1),
                 ObjectGet(BuyStop_TrendName, OBJPROP_PRICE1) + BuyStop_StepActive*Point,
                 ObjectGet(BuyStop_TrendName, OBJPROP_TIME2),
                 ObjectGet(BuyStop_TrendName, OBJPROP_PRICE2) + BuyStop_StepActive*Point,
                 ObjectGet(BuyStop_TrendName, OBJPROP_COLOR));
       SetObject("Prepare" + BuyStop_TrendName,
                 ObjectGet(BuyStop_TrendName, OBJPROP_TIME1),
                 ObjectGet(BuyStop_TrendName, OBJPROP_PRICE1) - BuyStop_StepPrepare*Point,
                 ObjectGet(BuyStop_TrendName, OBJPROP_TIME2),
                 ObjectGet(BuyStop_TrendName, OBJPROP_PRICE2) - BuyStop_StepPrepare*Point,
                 ObjectGet(BuyStop_TrendName, OBJPROP_COLOR));
       vA = NormalizeDouble(ObjectGetValueByShift("Active"+BuyStop_TrendName,0),Digits);
       vM = NormalizeDouble(ObjectGetValueByShift(BuyStop_TrendName,0),Digits);
       vP = NormalizeDouble(ObjectGetValueByShift("Prepare"+BuyStop_TrendName,0),Digits);
       sl = vA - BuyStop_StopLoss*Point;
       tp = vA + BuyStop_TakeProfit*Point;
       if(Ask <= vM && Ask >= vP && OrderFind(MagicBuyStop) == false)
           if(OrderSend(Symbol(), OP_BUYSTOP, BuyStop_Lot, vA, 3, sl, tp,"", MagicBuyStop, 0, Green) < 0)
               Print("Err (", GetLastError(), ") Open BuyStop Price= ", vA, " SL= ", sl," TP= ", tp);

       if(Ask <= vM && Ask >= vP && OrderFind(MagicBuyStop) == true && 
          glbOrderType == OP_BUYSTOP)
         {
           OrderSelect(glbOrderTicket, SELECT_BY_TICKET, MODE_TRADES);
           if(vA != OrderOpenPrice())
               if(OrderModify(glbOrderTicket, vA, sl, tp, 0, Green) == false)
                   Print("Err (", GetLastError(), ") Modify BuyStop Price= ", vA, 
                         " SL= ", sl, " TP= ", tp);
         }

       if(Ask < vP && OrderFind(MagicBuyStop) == true && 
          glbOrderType == OP_BUYSTOP && AutoClose==true)
         {
           OrderDelete(glbOrderTicket);
         }
     }
I am not sure of the logic but can I just input the CommentName in the following location? I have not tested this but it compiles fine.

Code:
if(OrderSend(Symbol(), OP_BUYSTOP, BuyStop_Lot, vA, 3, sl, tp,"CommentName", MagicBuyStop, 0, Green) < 0)
 Print("Err (", GetLastError(), ") Open BuyStop Price= ", vA, " SL= ", sl," TP= ", tp);
__________________
Proverbs [James]
Faith in Jesus helps me to see the invisible, believe the incredible and receive the impossible!
He makes all things new in my life.

Last edited by proverbs; 06-07-2007 at 05:08 PM.
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
  #608 (permalink)  
Old 06-07-2007, 06:56 PM
Junior Member
 
Join Date: Nov 2006
Posts: 19
Drivefast is on a distinguished road
Thank you Coderguru for being here for us!

I have a question about Alerts.

I want to change the alert type in this code so it will play a wav file that I choose and not have the popup window buy sell thing. Just play wav file when fractal apears.

How should the code be. I have attached the sFractals alert indicator.

if(PrevSignal <= 0 )
{
if(ExtDownFractalsBuffer[SIGNAL_BAR] > 0)
{
PrevSignal = 1;
Alert("sFractals (", Symbol(), ", ", Period(), ") - BUY!!!");
}
}
if(PrevSignal >= 0)
{
if(ExtUpFractalsBuffer[SIGNAL_BAR] > 0)
{
PrevSignal = -1;
Alert("sFractals (", Symbol(), ", ", Period(), ") - SELL!!!");
}
}
Attached Files
File Type: mq4 sFractals.mq4 (7.4 KB, 82 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
  #609 (permalink)  
Old 06-07-2007, 07:02 PM
ryanklefas's Avatar
Senior Member
 
Join Date: Apr 2006
Location: USA
Posts: 438
ryanklefas is on a distinguished road
Quote:
Originally Posted by proverbs
I am not sure of the logic but can I just input the CommentName in the following location? I have not tested this but it compiles fine.

Code:
if(OrderSend(Symbol(), OP_BUYSTOP, BuyStop_Lot, vA, 3, sl, tp,"CommentName", MagicBuyStop, 0, Green) < 0)
 Print("Err (", GetLastError(), ") Open BuyStop Price= ", vA, " SL= ", sl," TP= ", tp);
That will work fine. You can also put a string variable in that place.
__________________
"Don't work harder, work smarter." -- my Java professor

Advertise on The All New FireCell Network
"Where online investing makes sense"

Coder for Hire:
http://firecell.info
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
  #610 (permalink)  
Old 06-07-2007, 07:05 PM
ryanklefas's Avatar
Senior Member
 
Join Date: Apr 2006
Location: USA
Posts: 438
ryanklefas is on a distinguished road
Quote:
Originally Posted by Drivefast
Thank you Coderguru for being here for us!

I have a question about Alerts.

I want to change the alert type in this code so it will play a wav file that I choose and not have the popup window buy sell thing. Just play wav file when fractal apears.

How should the code be. I have attached the sFractals alert indicator.

if(PrevSignal <= 0 )
{
if(ExtDownFractalsBuffer[SIGNAL_BAR] > 0)
{
PrevSignal = 1;
Alert("sFractals (", Symbol(), ", ", Period(), ") - BUY!!!");
}
}
if(PrevSignal >= 0)
{
if(ExtUpFractalsBuffer[SIGNAL_BAR] > 0)
{
PrevSignal = -1;
Alert("sFractals (", Symbol(), ", ", Period(), ") - SELL!!!");
}
}
I think CodersGuru died or something. He hasn't been around in a while.

Anyway.... add this statement:

PlaySound("alert.wav");

.... where "alert.wav" is the name of the file that you want to play.
__________________
"Don't work harder, work smarter." -- my Java professor

Advertise on The All New FireCell Network
"Where online investing makes sense"

Coder for Hire:
http://firecell.info
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

Tags
forex, histogram, JMASlope, ToR 1.20, ZUP_v1.mq4


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


All times are GMT. The time now is 01:00 PM.



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