new2mql4, just need a little help pls~

 

what function to use so I can compare the value from a current indicator with its value within the last 10 minutes?

I tried to put those value into group but into trouble with limited knowledge of mql4....

so...could someone plssss help~~ THX A LOT~

 
Use iCustom(. . . . . . . 0) and iCustom(. . . . . . . 10), iCustom(. . . . . . . 9), iCustom(. . . . . . . 8), iCustom(. . . . . . . 7), iCustom(. . . . . . . 6), etc on PERIOD_M1
 
RaptorUK:
Use iCustom(. . . . . . . 0) and iCustom(. . . . . . . 10), iCustom(. . . . . . . 9), iCustom(. . . . . . . 8), iCustom(. . . . . . . 7), iCustom(. . . . . . . 6), etc on PERIOD_M1


thx for ur reply~

I tried to use the "shifting" of the indicator to represent the values and I put them like

if(

iCustom0< iCustom5 ||iCustom0< iCustom6 || iCustom0< iCustom7 || iCustom0< iCustom8 || iCustom0< iCustom9

)

and these words seem like no effect at all...

and if i put only one condition like "iCustom0< iCustom5", it has its effect..

I am wondering if I have used the "||" correctly...><

 
Show your iCustom calls . . .
 
RaptorUK:
Show your iCustom calls . . .


I tried to compare the vlaues of WPR as well, and the parameters are quite simple...

double W0;
double W1,W2,W3,W4,W5,W6,W7,W8,W9,W10;

W0=iWPR(NULL,0,14,0);

W1=iWPR(NULL,0,14,1);
W2=iWPR(NULL,0,14,2);
W3=iWPR(NULL,0,14,3);
W4=iWPR(NULL,0,14,4);
W5=iWPR(NULL,0,14,5);
W6=iWPR(NULL,0,14,6);
W7=iWPR(NULL,0,14,7);
W8=iWPR(NULL,0,14,8);
W9=iWPR(NULL,0,14,9);
W10=iWPR(NULL,0,14,10);

if (

W0>80

&& W0<W7 || W0<W8 || W0<W9 || W0<W10

){
OrderSend(Symbol(),OP_SELL,Lots,Bid,10,Bid+SL*Point,Bid-TP*Point,NULL,0,0,Red);

return(0);
}

just that simple...but "W0<W7 || W0<W8 || W0<W9 || W0<W10" seems no effect at all...

 
dont use icustom unless you are using a custom indicator. Use the respective indicators function e.g. iRSI, iMA etc
 
try this if( W0>80 &&(...||...||...) ) { // hit raptor on the head }
 
tonny:
try this if( W0>80 &&(...||...||...) ) { // hit raptor on the head }


OOOHHH..it worked! it is just as simple as adding the "()" ...

sometimes the solution is so simple and makes me feel so dumbbb....THX anyway~

and dont hit raptor ~its my problem that I did not explain the issue clearly~ lol~

btw, i tried also writing the code to close all position on Friday 21:55 just not to leave them till monday, but it keeps saying "wrong parameters count".....><

do you mind telling me what is wrong with my code?

appreciate that~~

if(
DayOfWeek()==5 && TimeHour()==21 && Minute()==55
) {OrderClose(0,0,Bid,10,Red); return(0); }

and also, can I use "OrderSend" to trade three different currency pairs like EURUSD, GBPUSD, AUDUSD in one EA?

 
diunilumi:


OOOHHH..it worked! it is just as simple as adding the "()" ...

sometimes the solution is so simple and makes me feel so dumbbb....THX anyway~

and dont hit raptor ~its my problem that I did not explain the issue clearly~ lol~

btw, i tried also writing the code to close all position on Friday 21:55 just not to leave them till monday, but it keeps saying "wrong parameters count".....><

do you mind telling me what is wrong with my code?

appreciate that~~

if(
DayOfWeek()==5 && TimeHour()==21 && Minute()==55
) {OrderClose(0,0,Bid,10,Red); return(0); }

and also, can I use "OrderSend" to trade three different currency pairs like EURUSD, GBPUSD, AUDUSD in one EA?

About raptor just kidding he's just always too serious about stuff anyway about your code the previous statement was dictating that W0>80 && W0<W7 must be present but you only wanted W0>80 compulsory.
 

if(
DayOfWeek()==5 && TimeHour()==21 && Minute()==55
) {OrderClose(0,0,Bid,10,Red); return(0); }

and also, can I use "OrderSend" to trade three different currency pairs like EURUSD, GBPUSD, AUDUSD in one EA?

See the highlighted you havent told your EA which trade to close nor how many lots. I would assume you would want to close all trades on friday. First you must cycle all open orders select them one by one then use OrderTicket() to fetch their ticket then OrderLots() to fetch its lot size put the two in the OrderClose() function, check if trade is buy close at Bid if its sell close at Ask or you get a requote.


if(/* time has come */){// check time


if(OrdersTotal()>0){                            // check number of orders if there are open ones then
  for(int i=1; i<=OrdersTotal(); i++){          // Cycle orders
  
      if (OrderSelect(i-1,SELECT_BY_POS)==true){  // If the next is available select it
      
           Comment("Attempting to close all orders");
     
          // close market orders
          if(OrderType()==OP_BUY) { OrderClose(OrderTicket(),OrderLots(),Bid,0,CLR_NONE); }   // close it
          if(OrderType()==OP_SELL) { OrderClose(OrderTicket(),OrderLots(),Ask,0,CLR_NONE); }
          
          // close pending OrderSelect
          if(OrderType()!=OP_BUY && OrderType()!=OP_SELL)
           {           
            OrderPrint(); //---- print selected order           
            bool result=OrderDelete(OrderTicket());                 // delete pending order
            if(result!=TRUE) Print("LastError = ", GetLastError()); // print error so if it fails i know whats wrong
            break;
           }                                                        // close pending
          
        }// order select
     }// cycle orders
}// number of orders




}// check time
 
tonny:
try this if( W0>80 &&(...||...||...) ) { // hit raptor on the head }
In order for diunilumi to not have to return with this exact question in the future, I think it's important to note the use of "||" and "&&". Diunilumi, I would suggest you brush up on your understanding of operations: https://docs.mql4.com/basis/operations and acquaint yourself as to what each is used for to better your programming experience in the future.