How to code? - page 255

 

Do you know how to remove indicators properties on screen?

Hi, i would like to remove the text on sub windows in Mt4

i manage to remove some of the text directly in the code but there's always some numbers left.. and i don't figure out where it can be in the code..

//---- name for DataWindow and indicator subwindow label

switch(TimeFrame)

{

case 1 : string TimeFrameStr="Period_M1"; break;

case 5 : TimeFrameStr="Period_M5"; break;

case 15 : TimeFrameStr="Period_M15"; break;

case 30 : TimeFrameStr="Period_M30"; break;

case 60 : TimeFrameStr="Period_H1"; break;

case 240 : TimeFrameStr="Period_H4"; break;

case 1440 : TimeFrameStr="Period_D1"; break;

case 10080 : TimeFrameStr="Period_W1"; break;

case 43200 : TimeFrameStr="Period_MN1"; break;

default : TimeFrameStr="Current Timeframe";

}

string short_name="MTF AbsoluteStrength("+TimeFrameStr+","+Mode+","+Length+","+Smooth+","+Signal+",,"+ModeMA+")";

IndicatorShortName(short_name);

SetIndexLabel(0,"Bulls");

SetIndexLabel(1,"Bears");

SetIndexLabel(2,"SignalBulls");

SetIndexLabel(3,"SignalBears");

//----

SetIndexDrawBegin(0,Length+Smooth+Signal);

SetIndexDrawBegin(1,Length+Smooth+Signal);

SetIndexDrawBegin(2,Length+Smooth+Signal);

SetIndexDrawBegin(3,Length+Smooth+Signal);

return(0);

}

In this one i have always some numbers left and i don't how to do to get it completly blank. if someone can help, thanks.

 

mt4 Coding HELP

Hi,

I am trying to learn mt4 coding. Have read CodersGuru's lessons and am reading the MLQ4 manual. I last coded in the days of Fortran 4, some 40 years ago,so I am very much out of the frame.

I have drawn a Flowchart of what I want to achieve, but I am at a loss of how to proceed.

I have opened MetaEditor and set up a new program file, but there I am stuck.

What I am trying to do is plot a base horizontal line and then the program will plot 4 additional lines at evenly spaced intervals. The base line value and the incremental value, are selected by the user.

But what I need to add to the progam has me stumped, it should be simple, but not to me.

If anyone would be kind enough to guide me through the stages and explain how and why things are done, I would

be very grateful.

Regards Allon

 

How to Code: only One Trade

Hello,

I will write a EA with two Trades if some rules are right but the EA should only open 1 Trade with:

Trade("AUDCAD",OP_BUY, dLots, 0,0, 0, iMagic, sComment);

and One trade from this:

Trade("AUDCHF",OP_BUY, dLots, 0,0, 0, iMagic, sComment);

The goal is, that the EA would open:

- 1 Trade "OP_BUY" with AUDCAD

- and 1 Trade "OP_BUY" with AUDCHF

How do i code it?

Thanks in Advance.

halobungie

 

EA changing color of MA line

Hi All,

I have been trying to figure this problem out over the last few days. I have a couple of moving average lines and i want to change the color of the lines.

I can't seem it figure it out. Can someone point me in the right direction.

I know the functions used are ima() & icustom() but how do i put it together?

Many thanks in advance.

Newbie

 

Profit calculated for several orders

Hi all,

I want an EA to close all open positions if the profit of all orders is equal to zero + x pips. How to program the ?

for example

- sellorder 0.5 lot openprice = 1.3789

- buyorder 0.4 lot openprice = 1.3745

- sellorder 0.2 lot openprice = 1.3721

- sellorder 0.1 lot openprice = 1.3676

Sorry for my bad english

Regards

derumuro

 

Hello all,

Where can i find the best Stochastic Momentum Indicator (SMI) ?

The 3-28-2008 edition by MLaden seems to be the one !?

I would be particularly interested by a SMI version with alert (on cross and on levels) but i am unable to find it.

My second request goes to a divergence alert tool. There are plenty (with different results), but which one seems to be the most useful (on large timeframe H4, D1, W1) ?

Thanks for your help,

CiloX

 

How to close all ? Help needed

I simply want to close all open orders in my EA when equity reaches -250$. I found an EA online that closes all orders. It has one CloseAll() function that closes all orders. So I copied it to my EA and called it in start() function like that:

if(AccountBalance()-AccountEquity()< -250)

CloseAll();

But EA works as usual, not restarting.If any programmer would point me in the right direction that would be great.

Thx.

 
ndtexpert:
I simply want to close all open orders in my EA when equity reaches -250$. I found an EA online that closes all orders. It has one CloseAll() function that closes all orders. So I copied it to my EA and called it in start() function like that:

if(AccountBalance()-AccountEquity()< -250)

CloseAll();

But EA works as usual, not restarting.If any programmer would point me in the right direction that would be great.

Thx.

The condition is ok, it's very simple condition so it has to work. It is something different, code of your ea would be helpfull.

The condition that you pointed is checking global equity and account ballance, you should write your own function to check only the profit /loss generated by this one ea and separate it by magic number. In this way you may check many ea's in the same time.

 
derumuro:
Hi all,

I want an EA to close all open positions if the profit of all orders is equal to zero + x pips. How to program the ?

for example

- sellorder 0.5 lot openprice = 1.3789

- buyorder 0.4 lot openprice = 1.3745

- sellorder 0.2 lot openprice = 1.3721

- sellorder 0.1 lot openprice = 1.3676

Sorry for my bad english

Regards

derumuro

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);

}

 
halobungie:
Hello,

I will write a EA with two Trades if some rules are right but the EA should only open 1 Trade with:

Trade("AUDCAD",OP_BUY, dLots, 0,0, 0, iMagic, sComment);

and One trade from this:

Trade("AUDCHF",OP_BUY, dLots, 0,0, 0, iMagic, sComment);

The goal is, that the EA would open:

- 1 Trade "OP_BUY" with AUDCAD

- and 1 Trade "OP_BUY" with AUDCHF

How do i code it?

Thanks in Advance.

halobungie

Hey!

You need to use MarketInfo function (to get Ask/Bid of specified cross) for this, and send Symbol name to OrderSend function.

Regards

Kale