How to code? - page 52

 
Devil2000:
What is "clock"? as far I know there's no "clock" function in MQL4.

You can try this

if(TimeHour(TimeCurrent())==7)

{

if(TimeMinute(TimeCurrent())==15) B== 1;

if(TimeMinute(TimeCurrent())==30) B== 2;

if(TimeMinute(TimeCurrent())==45) B== 3;

}

if(TimeHour(TimeCurrent())==8)

{

if(TimeMinute(TimeCurrent())==0) B== 4;

if(TimeMinute(TimeCurrent())==15) B== 5;

if(TimeMinute(TimeCurrent())==30) B== 6;

}

Of course I thought he had

datetime clocks = TimeCurrent();

in an earlier line.

Robert

 
MrPip:
Of course I thought he had

datetime clocks = TimeCurrent();

in an earlier line.

Robert

Really? I can't find it on the previous page.

That should be working. But in an hour, sometimes there will be some minutes missing due to your internet connection or server's lag.

 

Looking for Programmer to convert indicator to EA

Hello All,

I am looking for a programmer to convert an indicator into an expert advisor (or a stand alone EA that works with the existing indicator). It simply needs to either buy or sell where the signal is generated, and have the following in the abilities in the presets:

*Lot sizing

*Stop loss setting

*Trailing stop setting

*Money management lot sizing based on account balance.

Attached is a picture of the indicator.

Please PM me if you are interested in the project, or know someone who is.

Thanks in advance.

Files:
indicator.gif  23 kb
 
Devil2000:
Really? I can't find it on the previous page. That should be working. But in an hour, sometimes there will be some minutes missing due to your internet connection or server's lag.

sorry for the confusion this is the code for the Clocks so i can change with different GMT

double Clocks = TimeCurrent() - (Broker)*3600;

broker is broker time in GMT..

another problem code i need guys.. sorry if i ask too much..

my problem :

i want that it will only open a max of 1 floating sell and 1 floating buy in a day.. but can open more than a lot of buy or sell in a day.. if the EA runs three days and everyday order conditions are met then it will have 3 floating buy/sell or 6 floating buy and sell..

example:

DAy 1 = open a 1 buy hits Tp and open another buy = 1 buy still open

Day 2 = previous buy still open and open another buy = 2 buys still open

Day 3 = 2 buys still open and another buy open = 3 buys still open

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

{

if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) == false) break;

if(OrderSymbol()== Symbol () && OrderMagicNumber()== Magic_Number)

{

if(OrderType() == OP_BUY) buys++;

if(OrderType() == OP_SELL) sells++;

}

}

if (buys < 1) it orders a buy

if (sells < 1) it orders a sell when the conditions are met

 

You can use this to count only those which are opened today:

if(OrderType() == OP_BUY && OrderOpenTime() >= iTime(NULL, PERIOD_D1, 0)) buys++;
 

need quick help

i have these codes below.....

can somebody please check to see if they follow this rule...

If no trades on the chart then with signal it opens 1 lot.

if 1 trade already on the chart all the rest of the orders are double lot..

please verify,

total = OrdersTotal();

if(total>=2)

{

if(MA11>MA21 && MA12<MA22)

{

ticket=OrderSend(Symbol(),OP_BUY,2*Lots,Ask,5,Ask-stoploss*Point,0,0,Magic_number,0,Green);

return (0);

}

if(MA11MA22)

{

ticket=OrderSend(Symbol(),OP_SELL,2*Lots,Bid,5,Bid+stoploss*Point,0,0,Magic_number,0,Red);

return (0);

}

}

if(MA11>MA21 && MA12<MA22)

{

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,5,Ask-stoploss*Point,0,0,Magic_number,0,Green);

}

if(MA11MA22)

{

ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,5,Bid+stoploss*Point,0,0,Magic_number,0,Red);

}

}

 

Martingale?

You have no hope.....

 
kjhfdgjfhdghdf:
Martingale? You have no hope.....

i will keep it in mind, thx

 

i just change and added.. the red characters.. hope that helps..

total = OrdersTotal();

if(total>=1)

{

if(MA11>MA21 && MA12<MA22)

{

ticket=OrderSend(Symbol(),OP_BUY,2*Lots,Ask,5,Ask-stoploss*Point,0,0,Magic_number,0,Green);

return (0);

}

if(MA11MA22)

{

ticket=OrderSend(Symbol(),OP_SELL,2*Lots,Bid,5,Bid+stoploss*Point,0,0,Magic_number,0,Red);

return (0);

}

}

if(total<1)

{

if(MA11>MA21 && MA12<MA22)

{

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,5,Ask-stoploss*Point,0,0,Magic_number,0,Green);

}

if(MA11MA22)

{

ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,5,Bid+stoploss*Point,0,0,Magic_number,0,Red);

}

}
 

StopLoss on MAs crossing

In an EA, I have a SL=50.

How code if I want SL=50 OR crossing of 2 Ma ?

Thanks for help.

Reason: