Forex



Go Back   Forex Trading > Programming > MetaTrader
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
  #41 (permalink)  
Old 03-18-2006, 04:27 PM
shwetha's Avatar
Member
 
Join Date: Feb 2006
Posts: 52
shwetha is on a distinguished road
Talking i also had the same question

hi
even i had the same question and was lookin how to increase the lot size after a losing trade.
ex:
If previous trade has not reached the take profit level and is closed by stoploss/break even then lot size is two lots.

•If previous two trades has not reached the take profit level an closed by stop loss/break even then lot size is three lots.

•If previous three trades is not reached the take profit leveland closed by stop loss/break even then lot size is four lots.


i hope the guys here can help both of us by doing the code for the same
thanks in advance
shwetha

Quote:
Originally Posted by warpio
I want to know if there's any way to tell an EA to increase the lot size if the last trade closed in loss (martingale system), and use the normal lot size if the last trade closed in profit. It needs to be able to use micro lots. Is there any way to do this?
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
  #42 (permalink)  
Old 03-18-2006, 04:59 PM
FX5 FX5 is offline
Junior Member
 
Join Date: Oct 2005
Posts: 13
FX5 is on a distinguished road
Lightbulb Debugging MQL4 code

Hello Everybody,

I have a lot of problems in debuging the code written for MT4. So I thought of writting most of the code in a DLL file then import those function to my MQL4 code. The problem I am facing is that this method doesn't succeed for DLL's written in C#. Does anybody now where the problem could be? A demonstration code would be so much appreciated.

I would also appreciate any other ideas for debugging MQL4 code.

regrard,
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
  #43 (permalink)  
Old 03-18-2006, 05:09 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 994
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Arrow

Quote:
Originally Posted by FX5
Hello Everybody,

I have a lot of problems in debuging the code written for MT4. So I thought of writting most of the code in a DLL file then import those function to my MQL4 code. The problem I am facing is that this method doesn't succeed for DLL's written in C#. Does anybody now where the problem could be? A demonstration code would be so much appreciated.

I would also appreciate any other ideas for debugging MQL4 code.

regrard,
FX5,
I've wrote the dll code in C++, maybe it helps!
MT4 Files Functions Replacement.
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
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
  #44 (permalink)  
Old 03-18-2006, 05:33 PM
FX5 FX5 is offline
Junior Member
 
Join Date: Oct 2005
Posts: 13
FX5 is on a distinguished road
Thanks codersguru for the Ultrafast reply.

I will check the code and get back to you.
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
  #45 (permalink)  
Old 03-21-2006, 07:30 PM
Member
 
Join Date: Dec 2005
Posts: 58
techinvest is on a distinguished road
Check My MQL4 Code please.

This is just a sample EA based on a price/simple MA cross. The reason I'm asking to get it checked out is because it's essentially the backbone of a few EA's I'm developing (the structure, not the strategy). All I need to do is verify that this EA will only trade on the completion of a bar. If someone can help me verify this, I'd appreciate it a lot. I'm still pretty new to MQL4 and just want to get this double checked before I go any further. I have about 4 EA's being developed @ the moment, and just want to be sure they execute trades correctly. In this case it would be only on a full bar.

In the EA one would only need to change EachTickMode to TRUE to make it trade tick by tick instead of bar by bar. Anyway, that's the idea. I'd appreciate any help.
Attached Files
File Type: mq4 New Robot.mq4 (6.0 KB, 129 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
  #46 (permalink)  
Old 03-24-2006, 08:26 PM
Member
 
Join Date: Jan 2006
Posts: 33
DooMGuarD is on a distinguished road
Question Debug code

hi all

how i debug the code (experts, indicatos, script) in runtime
(step by step)

thanks
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
  #47 (permalink)  
Old 04-02-2006, 03:52 PM
intelligent_14's Avatar
Junior Member
 
Join Date: Mar 2006
Location: Tehran/Iran
Posts: 24
intelligent_14 is on a distinguished road
hi

as you know, the MA indicator attachs to the main chart window, so it's scale will equal to price ratio, when you want to set a level=20, it means, you want to draw a horizontal line at 20 price ratio, the prices are too far from 20, so you can't see any line
__________________
there wil be nothig for a person exept his efforts (Emam Ali Alayhesalam)
M.A.Gh
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
  #48 (permalink)  
Old 04-06-2006, 09:55 PM
BC Brett's Avatar
Member
 
Join Date: Mar 2006
Location: Vancouver, British Columbia
Posts: 33
BC Brett is on a distinguished road
Good Question

Quote:
Originally Posted by DooMGuarD
hi all

how i debug the code (experts, indicatos, script) in runtime
(step by step)

thanks
Wish I had the answer.
I just finished writing my first EA and tried testing it in Strategy Tester.
I was getting errors showing in the ST journal so I tried using the Print function in my EA to debug the problems. I've worked out a few bugs so far this way, but it's a slow process.

Last edited by BC Brett; 04-07-2006 at 09:38 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
  #49 (permalink)  
Old 04-09-2006, 12:03 PM
Senior Member
 
Join Date: Dec 2005
Posts: 217
eric79 is on a distinguished road
Need help with very simple EA

Hi
I am trying to code a very simple EA to test a strategy.
All it should do is open an order at a given time.
Take Profit, Stop Loss and position size are external variables.

I can't program but i tried to do it.
This is what i have but it doesn't open any trades in backtest.

Could anybody help me?
Thanks a lot.

Code:
//+------------------------------------------------------------------+
//|                                                           TH.mq4 |
//|                      Copyright © 2006, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

//---- input parameters
extern int       StartHour=0;
extern int       StartMinute=00;
extern int       TakeProfit=10;
extern int       StopLoss=20;
extern int       Lots=1;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   if (Hour()==StartHour && Minute() == StartMinute)
   {
   OrderSend(Symbol(),OP_BUY,Lots,Ask,3,StopLoss,Ask+TakeProfit*Point,"TH_Buy",16384,0,Green);
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+
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
  #50 (permalink)  
Old 04-09-2006, 02:13 PM
Member
 
Join Date: Mar 2006
Posts: 58
pengie is on a distinguished road
The problem is with your stoploss. Your OrderSend statement should be written as:

OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point,"TH_Buy",16384 ,0,Green);

Also, for some brokers, it is not possible to use 10pips as takeprofit. You may have to increase it to 15pips.
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
#include, candle time, CHinGsMAroonCLK, code, coders guru, conditionally, dll, eli hayun, Eur_harvester.ex4, expert adviser, expert advisor, forex, higher high, how to code, indicator, I_XO_A_H, kehedge, mechanical trading, metatrader command line, mt4, MT4-LevelStop-Reverse, OrderReliable.mqh, programming, rectangle tool, trading, volty channel stop


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
How to code this? iscuba11 Metatrader 4 mql 4 - Development course 1 08-03-2007 05:22 PM


All times are GMT. The time now is 02:42 AM.



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