Forex



Go Back   Forex Trading > Programming > Metatrader Programming






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
 
Thread Tools Display Modes
  #1 (permalink)  
Old 12-11-2005, 04:22 PM
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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 12-12-2005, 06:31 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
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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 12-12-2005, 09:10 PM
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, 558 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
  #4 (permalink)  
Old 12-17-2005, 04:48 PM
Senior Member
 
Join Date: Nov 2005
Posts: 118
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, 458 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
  #5 (permalink)  
Old 12-17-2005, 04:54 PM
Administrator
 
Join Date: Sep 2005
Posts: 20,016
Blog Entries: 235
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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #6 (permalink)  
Old 12-18-2005, 12:24 AM
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 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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #7 (permalink)  
Old 12-18-2005, 01:09 AM
Senior Member
 
Join Date: Nov 2005
Posts: 118
jdun is on a distinguished road
Thanks codersguru!
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
  #8 (permalink)  
Old 12-18-2005, 03:47 AM
Senior Member
 
Join Date: Nov 2005
Posts: 118
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, 314 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
  #9 (permalink)  
Old 12-22-2005, 04:16 PM
Senior Member
 
Join Date: Nov 2005
Posts: 118
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, 305 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
  #10 (permalink)  
Old 12-22-2005, 04:35 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 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!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

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 03:10 AM.



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