How to code? - page 211

 
dr.house7:
thanks Avalanche,

but it's not a solution for me, because i have a TP, i don't wait until opposite condition

Others idea ? PM me i'll pay you

Don't know why but I can't send PMs... Probably because I'm new member here.

In the sample above you don't need to wait opposite condition, this additional requirement (OrdersTotal()==0) tells your EA to open new order if you have no orders opened already.

I have couple of others methods for this case, so if this method is not good for you - you can reach me at favalanchex@gmail.com (Gtalk) or ICQ.

 
Avalanche2k:
Don't know why but I can't send PMs... Probably because I'm new member here.

In the sample above you don't need to wait opposite condition, this additional requirement (OrdersTotal()==0) tells your EA to open new order if you have no orders opened already.

I have couple of others methods for this case, so if this method is not good for you - you can reach me at favalanchex@gmail.com (Gtalk) or ICQ.

it's like that:

if i go long first time, than TP and close order , i don't want a next long again, but waiting for a short condition

Thanks Avalanche

 
dr.house7:
it's like that:

if i go long first time, than TP and close order , i don't want a next long again, but waiting for a short condition

Thanks Avalanche

Please check PM, now they are available for me.

 

Looking for EA that uses BUYSTOPS and SELLSTOPS

I am looking for any EA that uses BuyStops and Sellstops for example how to code this in an EA.

Dave

 
1Dave7:
I am looking for any EA that uses BuyStops and Sellstops for example how to code this in an EA. Dave

Hi, the only difference from usual EA is that you should have Entry Price and Stop Loss predefined. You can make them external variables or calculate according your logic. Then you can use something like that to set order for BUYSTOP:

OrderSend(Symbol(),OP_BUYSTOP,Lots,EntryPrice,0,StopLoss,0,NULL,MagicNumber,0,Blue);

 

how do can manage 20 Magic Numbers

Hi All,

I will open in a EA 20 orders with different Magic Numbers.

Example:

- openOrders = 5 with Magic Number 1 to 5

- Order No. 4 will be closed, Magic Number 4 = free

- if new order is to open, I get this the smallest free Magic Number

How to program it ?

Thanks !

Regards

derumuro

 
derumuro:
Hi All,

I will open in a EA 20 orders with different Magic Numbers.

Example:

- openOrders = 5 with Magic Number 1 to 5

- Order No. 4 will be closed, Magic Number 4 = free

- if new order is to open, I get this the smallest free Magic Number

How to program it ?

Thanks !

Regards

derumuro

First define getMagic() function which will give you magic numbers and put it in the ordersend function (as a parameter for setting the magic number).

Then indisde the get magic function you should do the following :

getMagic()

{

1) set loop for(int i = 1;i<21;i++) to check numbers from 1 to 20

2) next, do another loop (inside the first for) per each i number with for loop from 0 to OrdersTotal checking if you found the magic number equals i ,if you didn't found your magic number then it means that it is free and you can use it as return value of this function (getMagic) and pass it to the orderSend function, otherwise use contunue keyword to skip to another check of the magic number.

}

 
Roger09:
Try this: closing_price_of_bar = iClose(Symbol(),PERIOD_M1,iBarShift(Symbol(),PERIOD_M1,StrToTime("04:59"));

Now I need to know is the closing price for a specific bar is on each day. The would help me monitor the relative move in price to the close of the US DJIA stock index.

Any further assistance would be appreciated, thank you.

 
Sadly:
Now I need to know is the closing price for a specific bar is on each day. The would help me monitor the relative move in price to the close of the US DJIA stock index. Any further assistance would be appreciated, thank you.

If you need bars only, use:

double iClose( string symbol, int timeframe, int shift)

where "shift" - is a proper bar.

 

What I'm looking for is the closing price of the same bar for each day, specifically 19:59:00 GMT closing price (the time at which the DJIA closes in the UK).

iClose(Symbol(),PERIOD_M1,iBarShift(Symbol(),PERIOD_M1,StrToTime("19:59")));

Whilst your line of code worked perfectly, unfortunately it was only in my head that I thought it would show me the previous days closing prices too. The idea behind this is to mark the closing price of the 19:59:00 bar with an object so as to indicate the closing time of the DJIA and at what price the EURUSD was at that time.

So that's the closing price at a specific time each day; the closing price at 19:59:00 Mon-Fri.