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 12-11-2005, 03:22 PM
samahdi samahdi is offline
Junior Member
 
Join Date: Sep 2005
Posts: 15
samahdi is on a distinguished road
How to code?

Hi all:

I have a very simple EA based on EMA cross, the profit is a big negative. I would like to reverse the setting code. Anyone can help or tell me, where should I begin?

1. Should I look at the magic number? What is the magic number function?
How to calculate this number? or other.....

Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-12-2005, 05:31 PM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 986
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Exclamation

Quote:
Originally Posted by samahdi
Hi all:

I have a very simple EA based on EMA cross, the profit is a big negative. I would like to reverse the setting code. Anyone can help or tell me, where should I begin?

1. Should I look at the magic number? What is the magic number function?
How to calculate this number? or other.....

Thanks!
samahdi,

1- Could I see the code and tell me wht do you want to do?

2- magic number is a number you assign to your order(s) as a reference enables you to distinguish between the different orders.

You sould wait the third part of expert advisor lesson to know more about coding expert advisors.
__________________
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
  #3 (permalink)  
Old 12-12-2005, 08:10 PM
samahdi samahdi is offline
Junior Member
 
Join Date: Sep 2005
Posts: 15
samahdi is on a distinguished road
Quote:
Originally Posted by codersguru
samahdi,

1- Could I see the code and tell me wht do you want to do?

2- magic number is a number you assign to your order(s) as a reference enables you to distinguish between the different orders.

You sould wait the third part of expert advisor lesson to know more about coding expert advisors.
Thanks Coders' Guru for your reply.
This code is for the truesclaper 49p by Ron. I find that it very often opens positions in the good direction but,ended with a big lost at last. Just wounder if any possible can revease the code, so might be can turn the big lost to big gain....

Below is the EA code:

Thanks!
Attached Files
File Type: mq4 TrueScalper_v49P_Ron_MT4.mq4 (14.4 KB, 192 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-17-2005, 03:48 PM
jdun jdun is offline
Senior Member
 
Join Date: Nov 2005
Posts: 119
jdun is on a distinguished road
How to reverse Sell to Buy and Buy to Sell code?

What do I need to do to reverse the code from sell to buy and from buy to sell?
Attached Files
File Type: mq4 e-TrendManager.mq4 (6.4 KB, 194 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 12-17-2005, 03:54 PM
newdigital newdigital is offline
Administrator
 
Join Date: Sep 2005
Posts: 14,391
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
All that I know that in most cases it is not helping.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 12-17-2005, 11:24 PM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 986
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Arrow Reverse

Quote:
Originally Posted by jdun
What do I need to do to reverse the code from sell to buy and from buy to sell?
jdun,

The easiest way to reverse the code (sell to buy & buy to sell) is changing:

Code:
if(signal0 < signal1 ) GlobalVariableSet("TM0",1);
if(signal0 > signal1) GlobalVariableSet("TM0",0);
To:

Code:
if(signal0 > signal1 ) GlobalVariableSet("TM0",1);
if(signal0 < signal1) GlobalVariableSet("TM0",0);
__________________
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
  #7 (permalink)  
Old 12-18-2005, 12:09 AM
jdun jdun is offline
Senior Member
 
Join Date: Nov 2005
Posts: 119
jdun is on a distinguished road
Thanks codersguru!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 12-18-2005, 02:47 AM
jdun jdun is offline
Senior Member
 
Join Date: Nov 2005
Posts: 119
jdun is on a distinguished road
If you don't mind codersguru, which part of the code to I need to change to reverse this EA from buy to sell and sell to buy.

Thanks!
Attached Files
File Type: mq4 SilverTrendExpert_V3.mq4 (30.0 KB, 141 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 12-22-2005, 03:16 PM
jdun jdun is offline
Senior Member
 
Join Date: Nov 2005
Posts: 119
jdun is on a distinguished road
Code for SL and TP

Could someone tell me the code for stop loss and tp. I need to add it to this EA.
Attached Files
File Type: mq4 Hans123Trader_v8_sync_retry[1].mq4 (15.2 KB, 119 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 12-22-2005, 03:35 PM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 986
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Arrow SL & TP

Quote:
Originally Posted by jdun
Could someone tell me the code for stop loss and tp. I need to add it to this EA.
jdun,

The code of SL & TP has already written in this EA:
Look at these lines:

PHP Code:
if (Symbol()=="GBPUSD") {
      
PipsForEntry13;
      
TrailingStop 40;
      
TakeProfit 45
      
InitialStopLoss=33;
    } else    if (
Symbol()=="EURUSD") {
      
PipsForEntry13;
      
TrailingStop 30;
      
TakeProfit 45;
      
InitialStopLoss=23;
    } else    if (
Symbol()=="USDCHF") {
      
PipsForEntry13;
      
TrailingStop 30;
      
TakeProfit 45;
      
InitialStopLoss=15;
    } else {      
      
PipsForEntry13;
      
TrailingStop 30;
      
TakeProfit 45;
      
InitialStopLoss=30;
    } 
If you want to make SL & TP external variables which you can set, you have to comment the above lines of code and uncomment these lines:

PHP Code:
/*
extern int PipsForEntry= 5;
extern double TrailingStop = 40;
extern double TakeProfit = 120;
extern double InitialStopLoss=50;
*/ 
__________________
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
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:21 PM.