How to get total each of buy/sellstop/limit?

 

anyone know how to get the total of each buy, sell, buystop, sellstop, buylimit and sellstop by the script?

mean OP_BUYSTOP always stay at 4 order, if miss one of OP_BUYSTOP order, delete and order again all pending order. no of OP_BUY

for(int j=OrdersTotal()-1;j>=0;j--)

{

OrderSelect(j,SELECT_BY_POS,MODE_TRADES);

if (OrderMagicNumber() == magic)

{

if(OrderType()==OP_BUYSTOP && OrdersTotal()==levelstop){

Comment( "Buystop" );}

have any guide to teach me.

I am the begining, newbie. ^^|

want make my ea

thanks

tytian

 

int buytot = 0;

int selltot = 0;

int buystoptot = 0;

int sellstoptot = 0;

int buylimittot = 0;

int selllimittot = 0;

int magic=12345;

int i;

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

{

OrderSelect(i, SELECT_BY_POS, MODE_TRADES);

if(OrderMagicNumber==magic)

{

if (OrderType() == OP_BUY) buytot += 1;

if ( OrderType() == OP_SELL) selltot += 1;

if (OrderType() == OP_BUYSTOP) buystoptot += 1;

if ( OrderType() == OP_SELLSTOP) sellstoptot += 1;

if (OrderType() == OP_BUYLIMIT) buylimittot += 1;

if ( OrderType() == OP_SELLLIMIT) selllimittot += 1;

}

}

 
tytian:

mean OP_BUYSTOP always stay at 4 order, if miss one of OP_BUYSTOP order, delete and order again all pending order. no of OP_BUY

tytian

can you explain that more clearly?

 

Is it that you place 1 Buy(market) and 4 BuyStop(pending) orders. When the price moves up and hits the first BuyStop order price and triggers it into a market order, you close the first market order and delete the remaining 3 pending orders and replace them with 4 new pending orders.

I just want to make sure I understand you clearly in order to assist you with the coding.

 
raj:
int buytot = 0;

int selltot = 0;

int buystoptot = 0;

int sellstoptot = 0;

int buylimittot = 0;

int selllimittot = 0;

int magic=12345;

int i;

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

{

OrderSelect(i, SELECT_BY_POS, MODE_TRADES);

if(OrderMagicNumber==magic)

{

if (OrderType() == OP_BUY) buytot += 1;

if ( OrderType() == OP_SELL) selltot += 1;

if (OrderType() == OP_BUYSTOP) buystoptot += 1;

if ( OrderType() == OP_SELLSTOP) sellstoptot += 1;

if (OrderType() == OP_BUYLIMIT) buylimittot += 1;

if ( OrderType() == OP_SELLLIMIT) selllimittot += 1;

}

}

thank you raj. its work. going to test again...

 

tytian,

Actually I borrowed that piece of code from Mangman for one of my EA's.

 

Very impressive

tytian:
thank you all. I just finished my first EA. congratulation to me. fully auto

Very impressive. Good job. Not easy to reach this stage. Congrates.

Regards

David

 
davidke20:
Very impressive. Good job. Not easy to reach this stage. Congrates.

Regards

David

hi, davidke20. this system use blessing system rules to make it. test one to one it's work very well.

see the below backtest very good the result.

Files:
tian.gif  21 kb
 
tytian:
hi, davidke20. this system use blessing system rules to make it. test one to one it's work very well. see the below backtest very good the result.

... I'm speechless. Anyway, that kind of modelling quality is not enough. If you wanted to make sure your EA is going to be something big in the future, download the history data from MetaQuotes or Alpari. Make a 90% and above modelling quality backtest. That give you a bigger view of your system, whether its reliable. Cheers

Regards

David

 

thank for reply.

i can't find each total for it..

tytian

 
mangman:
Is it that you place 1 Buy(market) and 4 BuyStop(pending) orders. When the price moves up and hits the first BuyStop order price and triggers it into a market order, you close the first market order and delete the remaining 3 pending orders and replace them with 4 new pending orders. I just want to make sure I understand you clearly in order to assist you with the coding.

thanks for reading mangman.

yes.