Ruben Ortega #: I want to set the stop loss above the structure (view image)
“Until you can state what you mean by “structure” in concrete terms (MA, fractal, highest, etc.) it can not be coded.” Explain how you get (per your picture) № 1 and not № 5.
“Until you can state what you mean by “structure” in concrete terms (MA, fractal, highest, etc.) it can not be coded.” Explain how you get (per your picture) № 1 and not № 5.
//+------------------------------------------------------------------+//| Robot_50%.mq4 |//| Copyright 2021, MetaQuotes Software Corp. |//| https://www.mql5.com |//+------------------------------------------------------------------+#property copyright"Copyright 2021, MetaQuotes Software Corp."#property link"https://www.mql5.com"#property version"1.00"#property strictinputdouble SL = 5;
inputdouble TP = 5;
inputint magic = 1;
inputdouble HoraInicial=8;//0-23inputdouble HoraFinal=17 ;
//+------------------------------------------------------------------+//| Expert initialization function |//+------------------------------------------------------------------+intOnInit()
{
//---//---return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Expert deinitialization function |//+------------------------------------------------------------------+voidOnDeinit(constint reason)
{
//---
}
//+------------------------------------------------------------------+//| Expert tick function |//+------------------------------------------------------------------+voidOnTick()
{
//---bool trade = true;
for (int i=0;i<OrdersTotal();i++) {
int orden_seleccionada = OrderSelect (1,SELECT_BY_POS,MODE_TRADES);
if (OrderSymbol()==Symbol() && OrderMagicNumber()==magic) {
trade= false;
break;
}
}
if (trade==true ) {
if (venta()==true && FiltroCompra()==true/*&& OperacionesAbiertas()==0*/) {
int venta = OrderSend(NULL,OP_SELL,1,Bid,10,SL,TP,"Keltner inverso",magic,0, clrRed);
}
}
}
//+------------------------------------------------------------------+bool venta(){
double cuatro = 0;
double tres = 0;
double dos = 0;
double uno = 0;
double x = 0;
for(int i=2;i<250;i++){
double ind = iCustom(NULL,0,"ZigZag.ex4",20,5,1,0,i); //Here i start to make the stucture i wantif(ind!=0){
if(cuatro==0 && tres==0 && dos==0 && uno==0 && x==0){
cuatro = ind;
}
if(cuatro!=0 && tres==0 && dos==0 && uno==0 && x==0 && ind!=cuatro){
tres = ind;
}
if(cuatro!=0 && tres!=0 && dos==0 && uno==0 && x==0 && ind!=cuatro && ind!=tres){
dos = ind;
}
if(cuatro!=0 && tres!=0 && dos!=0 && uno==0 && x==0 && ind!=cuatro && ind!=tres && ind!=dos){
uno = ind;
}
if(cuatro!=0 && tres!=0 && dos!=0 && uno!=0 && x==0 && ind!=cuatro && ind!=tres && ind!=dos && ind!=uno){
x = ind;
break;
}
}
}
if( uno > dos && tres < uno && tres > cuatro && tres > dos && x < uno && cuatro < dos && High[1]>tres+50*Point && Close[2]<tres){
returntrue;
}else{
returnfalse;
}
}
double stoploss=Bid+100*Point;
double takeprofit=NormalizeDouble(Ask-200*Point,Digits);
bool FiltroCompra(){
if(Hour()>=HoraInicial && Hour()<=HoraFinal){
returntrue;
}
elsereturnfalse;}
int OperacionesAbiertas(){
int liOrders = 0;
for (int i = 0; i < OrdersTotal(); i++){
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == false){
continue;
}
if (OrderSymbol() != Symbol() || OrderMagicNumber() != magic){
continue;
}
liOrders++;
}
return(liOrders);
}
Here is the code and the image, i want to modify the stop loss above nº1 in the image. Thanks
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
The problem is that i dont know how to call to the high (nº1 view image) and put the stop there
Please draw a picture for BUY and for SELL. Specify Stop Loss and Take Profit.
Please draw a picture for BUY and for SELL. Specify Stop Loss and Take Profit.
I had drawn it (its only for sells) thank you - VIEW IMAGE
“Until you can state what you mean by “structure” in concrete terms (MA, fractal, highest, etc.) it can not be coded.” Explain how you get (per your picture) № 1 and not № 5.
“Until you can state what you mean by “structure” in concrete terms (MA, fractal, highest, etc.) it can not be coded.” Explain how you get (per your picture) № 1 and not № 5.
Here is the code and the image, i want to modify the stop loss above nº1 in the image. Thanks