How to code? - page 156

 

EA Attached

Attached is The EA I have been trying to make work

What I would like to do is have all the bar patterns fron each of the 3 TF's 30min 60min and 240min open granted this will add up to quite a few but. I can't seen to get it to work right.

It does trade but not the way I would like. so any help would be great.

Cheers

Beno

Files:
 

Take Profit Question

What would be the code to modify an order ( adjust the take profit of it ) after X amount of minutes has passed since the order has opened ? Thanks in advance to anyone who responds to this.

 

Mindhero

Hello everyone,

Can somebody help me creating an ea with the attached indicator. I just need to open position in direction of arrow.

Here is the indicator http://rosdi.name/forex/experts/indicators/RK_MindHero.mq4

Thanks

 

Please Edit my 2 Ea

I have two EAs that uses Multiframe MACD and Simple Moving average can anyone edit it for me ? This is my preferred the Signal setup >>>

.................................................. .................................................. .

Indicator 1 >>>>>> SELL : Once macd on 1hour and 15mins chart confirms negative divergence and 5 close period simple moving average crosses 10 close period simple moving average down on 15mins chart then Sell.

BUY : Once macd on 1hour and 15mins chart confirms positive divergence and 5 close period simple moving average crosses 10 close period simple moving average up on 15mins chart then Buy.

Stop Loss: 50

Take Profit: 15

Trailing Stop: 0

Lot: 0.1

.....................................................................................................

Indicator 2 >>>>>> SELL : Once macd on 4hours and 1hours chart confirms negative divergence and 5 close period simple moving average crosses 10 close period simple moving average down on 1 hour chart then Sell.

BUY:Once macd on 4hours and 1hours chart confirms positive divergence and 5 close period simple moving average crosses 10 close period simple moving average up on 1 hour chart then Buy.

Stop Loss: 100

Take Profit: 25

Trailing Stop: 0

Lot: 0.1

Thank You

Files:
 

Newbie 7-10 day trading signals

Hi all.

First post and hopefully someone here will be able to point me in the right direction!

I trade currencies via fixed odds platforms. My trades place that a certain level in the market will not be touched over a time period (eg. 7 days, 10 days etc).

I use various criteria for entering trades and have only now got around to thinking about automating them.

I've had a quick scan of the training lessons on here but without wanting to reinvent the wheel I wondered if anyone else had programmed anything along these lines? Basically the bits I am looking for help with are:

1) Email to send instant alert when criteria is met

2) The ability to backtest over a configurable amount of days to see if my level (configurable) would have been breached. The idea being that I could test different levels (for different returns) over the time periods and then adjust my strategy accordingly.

Hope I don't sound too dumb!

Thanks in advance!

 

EA stops trading but still shows a smiley

Hi,

I have a strange problem over here. I am running an EA (using one custom indicator). Sometimes it happens that the EA stops working (although the smiley is still there, but output on the chart for example is not printed any more). This happens without any warning and is very unpredictable.

Last time it occured I found the following in the EA log which shows that at 03:08:06 the EA was removed because the chart was closed (uninit reason 4). Thing is, I was sleeping at this time, definitely not thinking about closing charts. Since I publish the account to an FTP site every 5 mins and the last update was around 3AM I decided that this must be related. Unfortunately I do not have any clue on how to approach the problem.

Any ideas.

Best regards,

Stephan

 
mike360:
What would be the code to modify an order ( adjust the take profit of it ) after X amount of minutes has passed since the order has opened ? Thanks in advance to anyone who responds to this.

first you have to select the order using OrderSelect function,

then check the the order open time and compare it with time current,

you can change the Stop Loss and Take Profit

You might use the following code

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

{

OrderSelect(i,SELECT_BY_POS,MODE_TRADES)

if(TimeCurrent()-OrderOpenTime()>= after_X_amaount_of_time_in_seconds)

{

OrderModify(OrderTicket(),OrderOpenPrice(),New_SL,New_TP,0,CLR_NONE);

}

}

 
 

Study the OrderSelect() function. Get to know it well, it is important.

bool OrderSelect( int index, int select, int pool=MODE_TRADES)

The function selects an order for further processing. It returns TRUE if the function succeeds. It returns FALSE if the function fails. To get the error information, one has to call the GetLastError() function.

The pool parameter is ignored if the order is selected by the ticket number. The ticket number is a unique order identifier. To find out from what list the order has been selected, its close time must be analyzed. If the order close time equals to 0, the order is open or pending and taken from the terminal open positions list. One can distinguish an open position from a pending order by the order type. If the order close time does not equal to 0, the order is a closed order or a deleted pending order and was selected from the terminal history. They also differ from each other by their order types.

Parameters:

index - Order index or order ticket depending on the second parameter.

select - Selecting flags. It can be any of the following values:

SELECT_BY_POS - index in the order pool,

SELECT_BY_TICKET - index is order ticket.

pool - Optional order pool index. Used when the selected parameter is SELECT_BY_POS. It can be any of the following values:

MODE_TRADES (default)- order selected from trading pool(opened and pending orders),

MODE_HISTORY - order selected from history pool (closed and canceled order).

Sample:

if(OrderSelect(12470, SELECT_BY_TICKET)==true)

{

Print("order #12470 open price is ", OrderOpenPrice());

Print("order #12470 close price is ", OrderClosePrice());

}

else

Print("OrderSelect returned the error of ",GetLastError());

 

Download this also if you haven't found it already:

http://www.mql4.com/files/mql4bookenglish.chm

Reason: