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!

 
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.

 
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!

 

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?

Files:
 

All that I know that in most cases it is not helping.

 

Reverse

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:

if(signal0 < signal1 ) GlobalVariableSet("TM0",1);

if(signal0 > signal1) GlobalVariableSet("TM0",0);[/CODE]

To:

[CODE]if(signal0 > signal1 ) GlobalVariableSet("TM0",1);

if(signal0 < signal1) GlobalVariableSet("TM0",0);
 

Thanks codersguru!

 

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!

Files:
 

Code for SL and TP

Could someone tell me the code for stop loss and tp. I need to add it to this EA.

 

SL & TP

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:

if (Symbol()=="GBPUSD") {

PipsForEntry= 13;

TrailingStop = 40;

TakeProfit = 45;

InitialStopLoss=33;

} else if (Symbol()=="EURUSD") {

PipsForEntry= 13;

TrailingStop = 30;

TakeProfit = 45;

InitialStopLoss=23;

} else if (Symbol()=="USDCHF") {

PipsForEntry= 13;

TrailingStop = 30;

TakeProfit = 45;

InitialStopLoss=15;

} else {

PipsForEntry= 13;

TrailingStop = 30;

TakeProfit = 45;

InitialStopLoss=30;

} [/PHP]

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]/*

extern int PipsForEntry= 5;

extern double TrailingStop = 40;

extern double TakeProfit = 120;

extern double InitialStopLoss=50;

*/
 

how does one post code

Hi

Please tell me how to post code - so that it goes into a box that others can easily copy.

Thanks

Reason: