How to code? - page 256

 
Kalenzo:
The easiest way to do this is to check profit of each order (instead of counting pips and multiplying it by lot value). You should also separate the trades by magic number (so profit count also). Here is example of function that i'm using to count profit of selected ea (based on magic number):

double profitCount()

{

double oc = 0;

for(int cnt = 0 ;cnt<OrdersTotal();cnt++)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderMagicNumber() == Magic)

{

oc+= OrderProfit()+OrderSwap()+OrderCommission();

}

}

return(oc);

}

Hi Kalenzo,

Thanks for the Replay !

If the profit of all orders equal to zero, I would like to draw a horizontal line on the chart (for visual control or information). How can you calculate the point ?

Thanks

derumuro

 
Kalenzo:
The easiest way to do this is to check profit of each order (instead of counting pips and multiplying it by lot value). You should also separate the trades by magic number (so profit count also). Here is example of function that i'm using to count profit of selected ea (based on magic number):

double profitCount()

{

double oc = 0;

for(int cnt = 0 ;cnt<OrdersTotal();cnt++)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderMagicNumber() == Magic)

{

oc+= OrderProfit()+OrderSwap()+OrderCommission();

}

}

return(oc);

}

That EA is already made, You can find it on the Donnaforex forum MyCommunity

The name of the EA MoneyManagerEaVer02

It 's made by Ozan Buyuksemerci and it is free to download there if your a member of that site

So register and find your EA in the members zone

 
deVries:
That EA is already made, You can find it on the Donnaforex forum MyCommunity

The name of the EA MoneyManagerEaVer02

It 's made by Ozan Buyuksemerci and it is free to download there if your a member of that site

So register and find your EA in the members zone

Hi deVries,

thanks for the reply.

I found on the forum only version 1.0.

I use the Close All MULTIFUNCTIONAL EA.mq4 from here

ALL Order Related Indicators, Scripts and EA @ Forex Factory

The EA is similar to your EA.

The orders will be closed in the EAs for a certain profit level.

I would like to close the orders to x-pips in profit.

Regards

derumuro

 

Only ONE Trade per Night

Hello,

my EA should make only ONE Trade per Night.

I have this Code:

int IsTradeTime() {

int li_8;

if (DayOfWeek() EndingTradeDay) return (0);

int li_0 = 60 * TimeHour(TimeCurrent()) + TimeMinute(TimeCurrent());

int li_4 = 60 * StartHour + StartMinute;

li_8 = 60 * StopHour + li_8;

if (li_4 == li_8) return (1);

if (li_4 < li_8) {

if (!(li_0 >= li_4 && li_0 < li_8)) return (0);

return (1);

}

if (li_4 > li_8) {

if (!(li_0 >= li_4 || li_0 < li_8)) return (0);

return (1);

}

return (0);

}

But the Goal is that he Makes me only ONE Trade. How can i Coding this?

Thanks in Advance!

halobungie

 

how to calculate $gain per pip?

how to calculate $gain per pip?

please help^_^

 

Multi platform data on excel...

Hello,

I am new at MT4 scripting, so please help me...

I am working on 10 mt4 platforms testing few EAs, and what I would like to do, is export current account balance and profit to a excel or .csv or .txt file, once every 60 minutes (or different timeframes...) into a single file for all the platforms.

I am using a script but I have not the code and, unfortunely, this script report just one platform data for file...

There is a solution already developed for my request?

Thanks in advance for your patience...

 

digits before the point

Hello

I am using the snippets of code below and was wondering if there is a way of showing the OpenMinute setting with 2 digits before the point when printing onto the chart.

I would like to show as 01 when there is only a single digit before the point

extern int OpenMinute = 1;

string TradeSession="1st Session Open: "+OpenHour+""+OpenMinute+" Close: "+CloseHour+":"+CloseMinute+"";

Thanks very much for your help.

Regards

George

 

How to tell my EA not to trade when certain comments/Magic Numbers are generated?

Hello! I am working on an EA that generates Magic Numbers and uses them in the comments section of the trade. It does very well with the comments generated that are very long, but all the 3-digit comments generated by the EA end up losing!!

Is there a way I can filter out trades that have a 3-digit generated comment easily? Essentially, it would be telling the EA "Hey, if the comment is 3 digits long, don't open the trade. Otherwise, I'm fine with anything else."

Thanks!

 
RDKamikaze:
Hello! I am working on an EA that generates Magic Numbers and uses them in the comments section of the trade. It does very well with the comments generated that are very long, but all the 3-digit comments generated by the EA end up losing!!

Is there a way I can filter out trades that have a 3-digit generated comment easily? Essentially, it would be telling the EA "Hey, if the comment is 3 digits long, don't open the trade. Otherwise, I'm fine with anything else."

Thanks!

Hi RD,

Without seeing the code...this is just a few quick ideas to check...

The comments are related to a code operation that triggers the comments....

1) Find the code section that produces the comments.

2) That comment/operation most likely has values related to it that trigger the comments.

3) Use those values to filter your trades so those comments are not triggered...

Hope this helps,

Robert

 

Specific Coding Help

Hi, I have a viable EA I created based on a certain strategy that performs well during the UK open and a few hours into the USA open.

My problem is, I don't know how to code that in, and am looking for someone out there who can help me.

Basically, I want to be able to manually adjust the time of day the EA runs. Base it on either the broker's time or GMT.

For instance, I want the EA to start trading at 8:00am GMT until 5:00pm GMT and not to open any more trades until the following day.

Can anyone help me to achieve this?

Thanks in advance!

Reason: