[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 356

 

another question how to add indicators to MT4 ?


thanks

 
Garifyanov:

another question how to add indicators to MT4 ?


thanks

Don't the Documentation and Tutorial help?
 
artmedia70:
Don't the Documentation and the Textbook help?


Thanks, I'll check now.
 
Hello, I can't find an indicator that draws horizontal lines two days long on the high, low of a known time candle. Hit me with a link or maybe an outline of an indicator.
 

Can you please tell me why the EA is not trading. Put it on demo (smiles) - it doesn't work. Seems to have removed the function at the beginning that only allows trading when testing.

extern double Lots=1.0;

extern int Begin=10;

extern inttern Length=4;

extern int EOD=24;

extern inttern Pips=5;

extern int StopLoss=50;

extern int BreakEven=30;

extern inttern TakeProfit=80;


//+------------------------------------------------------------------+

//| expert start function |

//+------------------------------------------------------------------+

int start()

{

//----

int i,Ticket,LastOrderTime,StartTime,EODTime,Bought=0,Sold=0;

double EntryLong,EntryShort,SLLong,SLShort,TPLong,TPShort;

//Settings

if (Symbol()=="EURUSD"){

Begin=10;

Length=4;

EOD=24;

Pips=5;

StopLoss=50;

BreakEven=30;

TakeProfit=80;

}

else if (Symbol()=="GBPUSD"){

Begin=10;

Length=4;

EOD=24;

Pips=5;

StopLoss=70;

BreakEven=40;

TakeProfit=120;

}

else {

Begin=10;

Length=4;

EOD=24;

Pips=5;

StopLoss=50;

BreakEven=30;

TakeProfit=80;

}


//Count time

if(Hour()>=Begin-1)

{

StartTime= StrToTime(Begin+":00");

if(DayOfWeek()==5) EODTime = MathMin(StrToTime("22:55"),StrToTime(EOD+":00"));

else EODTime = StartTime+(EOD-Begin)*3600-60;

}

//Set orders

if(CurTime()>= StartTime && CurTime()<StartTime+300){

//Determine range

EntryLong =High[Highest(NULL,0,MODE_HIGH,Length*60/Period(),0)]+(Pips+MarketInfo(Symbol(),MODE_SPREAD))*Point;

EntryShort =Low [Lowest (NULL,0,MODE_LOW, Length*60/Period(),0)]-Pips*Point;

SLLong =MathMax(EntryLong-StopLoss*Point,EntryShort);

SLShort =MathMin(EntryShort+StopLoss*Point,EntryLong);

TPLong =EntryLong+TakeProfit*Point;

TPShort =EntryShort-TakeProfit*Point;

//Check Orders

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

OrderSelect(i,SELECT_BY_POS,MODE_TRADES);

if(OrderSymbol()==Symbol() && (OrderType()==OP_BUYSTOP || OrderType()==OP_BUY)) Bought++;

if(Bought>1){ //more than 1 buy order

if(CurTime()<=GlobalVariableGet("LastOrderTime")+10) Sleep(10000);

if(OrderSymbol()==Symbol() && OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),Bid,3,Red);

if(OrderSymbol()==Symbol() && OrderType()==OP_BUYSTOP) OrderDelete(OrderTicket();

}


if(OrderSymbol()==Symbol() && (OrderType()==OP_SELLSTOP || OrderType()==OP_SELL)) Sold++;

if(Sold>1){ //more than 1 sell order

if(CurTime()<=GlobalVariableGet("LastOrderTime")+10) Sleep(10000);

if(OrderSymbol()==Symbol() && OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),Ask,3,Red);

if(OrderSymbol()==Symbol() && OrderType()==OP_SELLSTOP) OrderDelete(OrderTicket());

}

}

if(Bought==0){ //no buy order

if(CurTime()<=GlobalVariableGet("LastOrderTime")+10) Sleep(10000);

Ticket=OrderSend(Symbol(),OP_BUYSTOP,Lots,EntryLong,3,SLLong,TPLong,NULL,0,0,Green);

if(Ticket<0 && GetLastError()==130)

Ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,SLLong,TPLong,NULL,0,0,Green);

GlobalVariableSet("LastOrderTime",OrderOpenTime())

}

if(Sold==0){ //no sell order

if(CurTime()<=GlobalVariableGet("LastOrderTime")+10) Sleep(10000);

Ticket=OrderSend(Symbol(),OP_SELLSTOP,Lots,EntryShort,3,SLShort,TPShort,NULL,0,0,Green);

if(Ticket<0 && GetLastError()==130)

Ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,SLShort,TPShort,NULL,0,0,Green);

GlobalVariableSet("LastOrderTime",OrderOpenTime())

}

}

//Manage opened orders

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

OrderSelect(i,SELECT_BY_POS,MODE_TRADES);

if(CurTime()<=GlobalVariableGet("LastOrderTime")+10) Sleep(10000);

//uzavšenín pozic na konci dne

if(CurTime()>=EODTime){

if(OrderSymbol()==Symbol() && OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),Bid,3,Red);

if(OrderSymbol()==Symbol() && OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),Ask,3,Red);

if(OrderSymbol()==Symbol() && OrderType()==OP_BUYSTOP) OrderDelete(OrderTicket());

if(OrderSymbol()==Symbol() && OrderType()==OP_SELLSTOP) OrderDelete(OrderTicket());

GlobalVariableSet("LastOrderTime",CurTime());

}

//move at BE if profit>BE

else {

if(OrderSymbol()==Symbol() && OrderType()==OP_BUY){

if(High[0]-OrderOpenPrice()>=BreakEven*Point && OrderStopLoss()!=OrderOpenPrice()){

OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0,Green);

GlobalVariableSet("LastOrderTime",CurTime());

}

}

if(OrderSymbol()==Symbol() && OrderType()==OP_SELL){

if(OrderOpenPrice()-Low[0]>=BreakEven*Point && OrderStopLoss()!=OrderOpenPrice()){

OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0,Green);

GlobalVariableSet("LastOrderTime",CurTime());

}

}

}

}

//Reset global variables at EOD

if(CurTime()>=EODTime) GlobalVariablesDeleteAll();

return(0);

}

//+------------------------------------------------------------------+

 
Good day all. I have installed MT4 FIFTYZNAK. iMA indicator gives 4 digits, but how to get 5 digits? Please help me to understand.
 
MK07:
Good day to all. I have installed MT4 FIFTY-ZNAK. iMA indicator gives 4 signs, but how to receive 5 signs? Please help to understand.

It has a value with five digits. To see its value, use

string DoubleToStr( double value, int digits)

Convert a numeric value to a text string containing a character representation of a number in a specified accuracy format.

Parameters:


value - Floating point value.

digits - Number of digits after decimal point (0-8).


Example:
  string value=DoubleToStr(1.28473418, 5);
  // содержимое строки value - "1.28473"
 
laveosa:

Roman ... Good to see you. Tried it, it doesn't work, I don't understand what's wrong, visually there is a history for the above period, but when tested there is no??? :/

Press F2 and download till you're unconscious! ;))
 

How do you indicate to the program that the bar has touched the moving average? You don't need a maximum or minimum value, you need to show a touch.

 
Forexman77:

How do you indicate to the program that the bar has touched the moving average? You don't need a maximum or minimum value, you need to show a touch.

The maximum (current) High[0] is above the MA, and consequently the minimum (current) Low[0] is below the MA (as I understand, we are talking about the 0th bar).