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
  #41 (permalink)  
Old 03-18-2006, 03:27 PM
shwetha's Avatar
shwetha shwetha is offline
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!
Reply With Quote
  #42 (permalink)  
Old 03-18-2006, 03: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!
Reply With Quote
  #43 (permalink)  
Old 03-18-2006, 04:09 PM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 987
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!
Reply With Quote
  #44 (permalink)  
Old 03-18-2006, 04: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!
Reply With Quote
  #45 (permalink)  
Old 03-21-2006, 06:30 PM
techinvest techinvest is offline
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, 75 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #46 (permalink)  
Old 03-24-2006, 07:26 PM
DooMGuarD DooMGuarD is offline
Member
 
Join Date: Jan 2006
Posts: 30
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!
Reply With Quote
  #47 (permalink)  
Old 04-02-2006, 02:52 PM
intelligent_14's Avatar
intelligent_14 intelligent_14 is offline
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!
Reply With Quote
  #48 (permalink)  
Old 04-06-2006, 08:55 PM
BC Brett's Avatar
BC Brett BC Brett is offline
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 08:38 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #49 (permalink)  
Old 04-09-2006, 11:03 AM
eric79 eric79 is offline
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!
Reply With Quote
  #50 (permalink)  
Old 04-09-2006, 01:13 PM
pengie pengie is offline
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!
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 code this? iscuba11 Metatrader 4 mql 4 - Development course 1 08-03-2007 04:22 PM


All times are GMT. The time now is 10:18 PM.