How to code? - page 203

 

2 Days and still stuck

Hi,

I am trying to add a delay after a buystop order has been deleted. I have writen the code below and although it compiles ok, it doesn't work.

Can anyone see what I am doing wrong or give me the line of code that will work for this.

thanks

// Time Delay for the next "Buy Stop" Order after buystop is deleted.

if (MayOpenDeferOrder && NextBuyStop_Order_Minutes !=0)//Time Delay for the next Buy Stop Order

{

int ordersHistoryTotal = OrdersHistoryTotal();

for (int o=ordersHistoryTotal;o<=0;o--) //Count down until it hits the total trades in history

{

if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)) //Getting all historical trades

if ((Symbol() == OrderSymbol()) && (OrderComment() == "Buy Stop Deleted.")) continue;

// "Buy Stop Deleted." is the user comment

//added when a buystop order is deleted.

{

if(((TimeCurrent() - OrderOpenTime())/60) < NextBuyStop_Order_Minutes) MayOpenDeferOrder = false;

break; //MayOpenDeferOrder==BuyStop Order

}

}

}

 

Hi,

For some reason, I cannot edit my post but the use of the "i" instead of the o in the order select statement has been changed and it still does not work

asgard2:

// Time Delay for the next "Buy Stop" Order after buystop is deleted.

if (MayOpenDeferOrder && NextBuyStop_Order_Minutes !=0)//Time Delay for the next Buy Stop Order

{

int ordersHistoryTotal = OrdersHistoryTotal();

for (int o=ordersHistoryTotal;o<=0;o--) //Count down until it hits the total trades in history

{

if(OrderSelect(o,SELECT_BY_POS,MODE_HISTORY)) //Getting all historical trades

if ((Symbol() == OrderSymbol()) && (OrderComment() == "Buy Stop Deleted.")) continue;

// "Buy Stop Deleted." is the user comment

//added when a buystop order is deleted.

{

if(((TimeCurrent() - OrderOpenTime())/60) < NextBuyStop_Order_Minutes) MayOpenDeferOrder = false;

break; //MayOpenDeferOrder==BuyStop Order

}

}

}

 
asgard2:
Hi, For some reason, I cannot edit my post but the use of the "i" instead of the o in the order select statement has been changed and it still does not work

a) always use braces around the then-clauses (and else-clases). That might help you seeing program flow mistakes. E.g., there is a dubious "break" in the for-clause.

b) the order list is not necessarily in time order; it can be reordered via the GUI.

 

Hide TP

Roger09:
Replace
void OpenBuy()

{

int ticket,err;

if (!GlobalVariableCheck("InTrade")) {

GlobalVariableSet("InTrade", CurTime()); // set lock indicator

ticket = OrderSend(Symbol(),OP_BUY,lot2,Ask,1,0,Ask+TP*Poin t,"Ask-StopLoss*Point,EA Order",magic,0,Red);

GlobalVariableDel("InTrade"); // clear lock indicator

}

}

void OpenSell()

{

int ticket,err;

if (!GlobalVariableCheck("InTrade")) {

GlobalVariableSet("InTrade", CurTime()); // set lock indicator

ticket = OrderSend(Symbol(),OP_SELL,lot2,Bid,1,0,Bid-TP*Point,Bid+StopLoss*Point,"EA Order",magic,0,Red);

GlobalVariableDel("InTrade"); // clear lock indicator

}

}[/CODE]

to

[CODE]void OpenBuy()

{

int ticket,err;

if (!GlobalVariableCheck("InTrade")) {

GlobalVariableSet("InTrade", CurTime()); // set lock indicator

ticket = OrderSend(Symbol(),OP_BUY,lot2,Ask,1,0,0,"Ask-StopLoss*Point,EA Order",magic,0,Red);

GlobalVariableDel("InTrade"); // clear lock indicator

}

}

void OpenSell()

{

int ticket,err;

if (!GlobalVariableCheck("InTrade")) {

GlobalVariableSet("InTrade", CurTime()); // set lock indicator

ticket = OrderSend(Symbol(),OP_SELL,lot2,Bid,1,0,0,"EA Order",magic,0,Red);

GlobalVariableDel("InTrade"); // clear lock indicator

}

}

Thank you very much for your kindness, Roger09.

Please accept my apology for my late response.

I will test the code and I will be back to you for the result.

=s=

 

How to get the total pixels of a window?

Hi,

I need to place some lable in proportion to the total number of pixels of x-axis and y-axis of the window. But how can I get the total number of pixels?

Cheers.

xecret

 

Hide TP

Roger09,

Refering to Post #2028.

The result was not as I expected.

What I meant by Hide TP is not without TP level, instead, it is invisible yet still taking profit as set in parameter.

Anyway, thank you very much for your help.

=s=

 

Convert From VT To MT4

hello

I am trying to convert from VT to MT4

Have I done this correctly?

MT4

if (h>h1 && l>=l1 && h-l>h1-l1 && c==h-l*0.5+l && c>c+1 && h>=h+1 && v<v1 && v<v2 && NoDemand2)Order = NoDemand4;

if (l<l1 && hh1-l1 && c==h-l*0.5+l && c=l+1 && v<v1 && v<v2 && NoSupply2)Order = NoSupply4;

VT

NoDemand4:=If(H>ref(H,-1) and L>=ref(L,-1) and (H-L)>ref((H-L),-1) and C=((H-L)*0.5)+L and C>ref(C,+1) and H>=ref(H,+1) and V<ref(V,-1) and V<ref(V,-2) and NoDemand2=0,1,0);

NoSupply4:=If(L<ref(L,-1) and Href((H-L),-1) and C=((H-L)*0.5)+L and C<ref(C,+1) and L<=ref(L,+1) and V<ref(V,-1) and V<ref(V,-2) and NoSupply2=0,1,0);

Cheers

Beno

 

Free EA reward for programming

Hello,

I need someone who can read "messed up" mq4 code.

I'm trying to merge 2 EA into one ultimate EA.

If interested, email nycv2@yahoo.com

I will share the EA once it's done. (I'm gonna sell it for $2000. Free only to the person who can help me write the code.)

Thanks

 

in search of a good accurate EA

please can somebody help me with a good and accurate EA , i lost a lot of money trading manually.

 
wayhuck:
Hello,

I need someone who can read "messed up" mq4 code.

I'm trying to merge 2 EA into one ultimate EA.

If interested, email nycv2@yahoo.com

I will share the EA once it's done. (I'm gonna sell it for $2000. Free only to the person who can help me write the code.)

Thanks

So you're great plan is to take two free EA's that you probably found here and 'merge' them together and sell it for 2K a pop? You've got some nerve buddy! Maybe if you're really lucky one of the two guys that actually gave up their time, effort and knowledge for free will offer to do it for you.

Oh but wait! If the code is 'messed up' then the EA's are mostly likely commercial EA's that have been decompiled. Is that it? Moron!!!

Lux