[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 291
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Help please have an advisor to break through fractals. I picked up good parameters only need to add that it sets a lot of martingale (2 more when you lose).Or give me a clue about the advisor which will only double the lot without waiting for a draw to 2 run (if available).Here is an advisor:
//+------------------------------------------------------------------+
|| Fractals.mq4 |
//| TO |
//| http://www.forex-tradexperts-to.narod.ru |
//+------------------------------------------------------------------+
#property copyright "TO"
#property link "http://www.forex-tradexperts-to.narod.ru"
#include <WinUser32.mqh>.
extern int TP_Fract_3=300;
extern int SL_Fract_3=200;
extern int TP_Fract_11=500;
extern int SL_Fract_11=300;
extern bool buy_Fract_3=true;
extern bool sell_Fract_3=true;
extern bool buy_Fract_11=true;
extern bool sell_Fract_11=true;
extern bool podtvergdenie=false;
extern int tofract=10;
extern double lots=0.1;
extern int ID = 5452;
string com;
double spread;
int init()
{
com=DoubleToStr(ID,0);
spread=MarketInfo(Symbol(),MODE_SPREAD)*Point;
return(0);
}
int deinit()
{
return(0);
}
datetime t1,t2=0;
bool order(double price,int type,string c,int m)
{
int i;
for(i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderComment()==c && OrderMagicNumber()==m && OrderOpenPrice()==price && OrderType()==type)return(false);
if(i==0)return(true);
}
if(OrdersTotal()==0)return(true);
}
int start()
{
int i,ret;
t1=Time[0];
if(t1!=t2)
{
int fract_buy_3=iHighest(Symbol(),Period(),MODE_HIGH,5,1);
int fract_sell_3=iLowest(Symbol(),Period(),MODE_LOW,5,1);
int fract_buy_11=iHighest(Symbol(),Period(),MODE_HIGH,21,1);
int fract_sell_11=iLowest(Symbol(),Period(),MODE_LOW,21,1);
if( fract_buy_3==3 && buy_Fract_3==true)
{
if(OrdersTotal()==0)if(order(High[fract_buy_3]+tofract*Point+spread,4,com,5))OrderSend(Symbol(),OP_BUYSTOP,lots,High[fract_buy_3]+tofract*Point+spread,10,High[fract_buy_3]+tofract*Point-SL_Fract_3*Point,High[fract_buy_3]+tofract*Point+spread+TP_Fract_3*Point,5);
for(i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderComment()==com && OrderMagicNumber()==5 && OrderType()==4)
{
OrderModify(OrderTicket(),High[fract_buy_3]+tofract*Point+spread, High[fract_buy_3]+tofract*Point-SL_Fract_3*Point, High[fract_buy_3]+tofract*Point+spread+TP_Fract_3*Point,0,Blue);
break;
}
if(i==0)if(order(High[fract_buy_3]+tofract*Point+spread,4,com,5))
{
if(podtvergdenie)
{
ret=MessageBox("Signal at "+Symbol()+" H1 BUYSTOP "+"{Set Order?", "Signal", MB_YESNO|MB_ICONQUESTION);
if(ret==IDYES)OrderSend(Symbol(),OP_BUYSTOP,lots,High[fract_buy_3]+tofract*Point+spread,10,High[fract_buy_3]+tofract*Point-SL_Fract_3*Point,High[fract_buy_3]+tofract*Point+spread+TP_Fract_3*Point,5);
}
if(!podtvergdenie)OrderSend(Symbol(),OP_BUYSTOP,lots,High[fract_buy_3]+tofract*Point+spread,10,High[fract_buy_3]+tofract*Point-SL_Fract_3*Point,High[fract_buy_3]+tofract*Point+spread+TP_Fract_3*Point,com,5);
}
}
}
if( fract_sell_3==3 && sell_Fract_3==true)
{
if(OrdersTotal()==0)if(order(Low[fract_sell_3]-tofract*Point,5,com,5))OrderSend(Symbol(),OP_SELLSTOP,lots,Low[fract_sell_3]-tofract*Point,10,Low[fract_sell_3]+spread-tofract*Point+SL_Fract_3*Point,Low[fract_sell_3]-tofract*Point-TP_Fract_3*Point,com,5);
for(i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderComment()==com && OrderMagicNumber()==5 && OrderType()==5)
{
OrderModify(OrderTicket(),Low[fract_sell_3]-tofract*Point,Low[fract_sell_3]+spread-tofract*Point+SL_Fract_3*Point,Low[fract_sell_3]-tofract*Point-TP_Fract_3*Point,0,Red);
break;
}
if(i==0)if(order(Low[fract_sell_3]-tofract*Point,5,com,5))
{
if(podtvergdenie)
{
ret=MessageBox("Signal on "+Symbol()+"H1 SELLSTOP "+"{Set Order?", "Signal", MB_YESNO|MB_ICONQUESTION);
if(ret==IDYES)OrderSend(Symbol(),OP_SELLSTOP,lots,Low[fract_sell_3]-tofract*Point,10,Low[fract_sell_3]+spread-tofract*Point+SL_Fract_3*Point,Low[fract_sell_3]-tofract*Point-TP_Fract_3*Point,5);
}
if(!podtvergdenie)OrderSend(Symbol(),OP_SELLSTOP,lots,Low[fract_sell_3]-tofract*Point,10,Low[fract_sell_3]+spread-tofract*Point+SL_Fract_3*Point,Low[fract_sell_3]-tofract*Point*Point,com,5);
}
}
}
if( fract_buy_11==11 && buy_Fract_11==true)
{
if(OrdersTotal()==0)if(order(High[fract_buy_11]+tofract*Point+spread,4,com,21))orderSend(Symbol(),OP_BUYSTOP,lots,High[fract_buy_11]+tofract*Point+spread,10,High[fract_buy_11]+tofract*Point-SL_Fract_11*Point,High[fract_buy_11]+tofract*Point+spread+TP_Fract_11*Point,21);
for(i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderComment()==com && OrderMagicNumber()==21 && OrderType()==4)
{
OrderModify(OrderTicket(),High[fract_buy_11]+tofract*Point+spread, High[fract_buy_11]+tofract*Point-SL_Fract_11*Point, High[fract_buy_11]+tofract*Point+spread+TP_Fract_11*Point,0,Blue);
break;
}
if(i==0)if(order(High[fract_buy_11]+tofract*Point+spread,4,com,21))
{
if(podtvergdenie)
{
ret=MessageBox("Signal on "+Symbol()+"H4 BUYSTOP "+"{Set Order?", "Signal", MB_YESNO|MB_ICONQUESTION);
if(ret==IDYES)OrderSend(Symbol(),OP_BUYSTOP,High[fract_buy_11]+tofract*Point+spread,10,High[fract_buy_11]+tofract*Point-SL_Fract_11*Point,High[fract_buy_11]+tofract*Point+spread+TP_Fract_11*Point,21);
}
if(!podtvergdenie)OrderSend(Symbol(),OP_BUYSTOP,lots,High[fract_buy_11]+tofract*Point+spread,10,High[fract_buy_11]+tofract*Point-SL_Fract_11*Point,High[fract_buy_11]+tofract*Point+spread+TP_Fract_11*Point,com,21);
}
}
}
if( fract_sell_11==11 && sell_Fract_11==true)
{
if(OrdersTotal()==0)if(order(Low[fract_sell_11]-tofract*Point,5,com,21))orderSend(Symbol(),OP_SELLSTOP,lots,Low[fract_sell_11]-tofract*Point,10,Low[fract_sell_11]+spread-tofract*Point+SL_Fract_11*Point,Low[fract_sell_11]-tofract*Point-TP_Fract_11*Point,com,21);
for(i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderComment()==com && OrderMagicNumber()==21 && OrderType()==5)
{
OrderModify(OrderTicket(),Low[fract_sell_11]-tofract*Point,Low[fract_sell_11]+spread-tofract*Point+SL_Fract_11*Point,Low[fract_sell_11]-tofract*Point-TP_Fract_11*Point,0,Red);
break;
}
if(i==0)if(order(Low[fract_sell_11]-tofract*Point,5,com,21))
{
if(podtvergdenie)
{
ret=MessageBox("Signal on "+Symbol()+"H4 BUYSTOP "+"{Set Order?", "Signal", MB_YESNO|MB_ICONQUESTION);
if(ret==IDYES)OrderSend(Symbol(),OP_SELLSTOP,lots,Low[fract_sell_11]-tofract*Point,10,Low[fract_sell_11]+spread-tofract*Point+SL_Fract_11*Point,Low[fract_sell_11]-tofract*Point-TP_Fract_11*Point,21);
}
if(!podtvergdenie)OrderSend(Symbol(),OP_SELLSTOP,lots,Low[fract_sell_11]-tofract*Point,10,Low[fract_sell_11]+spread-tofract*Point+SL_Fract_11*Point,Low[fract_sell_11]-tofract*Point*Point,com,21);
}
}
}
t2=Time[0];
}
return(0);
}
I'm bad at writing Russian, sorry!
I'm not good at writing Russian, sorry!
Tell me who can help with the Klimov block, the problem is that it does not return the value of the last closed, but the value of the last closed by the condition
so at 2 conditions
it returns both values True,
how to make it return only last closed order and not last one by a conditional,
i added a lot check to the code for my convenience
Tell me who can help with the Klimov block, the problem is that it does not return the value of the last closed, but the value of the last closed by the condition
so at 2 conditions
it returns both values True,
how to make it return only last closed order and not last one by a conditional,
i've added a lot check to the code for my convenience
Did you add the check of lots to this function? Now they check the last closed positions with the passed lot, and the lot is probably always equal to zero, or an integer. The variable ll must be of type double. Why do we need lot checking here anyway?
You write down what you want to achieve, and they will tell you :)
Yes, and why is the lot an int? The lot has always been double.
You could do this, when you have one order left, determine which order is left and search for the opposite one.
Tell me who can help with the Klimov block...
Check lots in the function added by yourself? Now they check the last closed positions with the passed lot, and the lot is probably always equal to zero, or an integer. The variable ll must be of type double. Why do we need lot checking here anyway?
You write down what you want to achieve, and they will tell you :)
I have already achieved everything, but there is one bug, it is at a certain moment an order I don't need pops up,
I tried to change it to int, originally it was double but I forgot to return it, and if I use a separate function without lot check, the result does not change, so maybe I did not check it correctly, help me to understand what is wrong with this bug
this is what the request looks like
Yes, and why is the lot an int? The lot has always been double.
You could do this, when you have one order left, determine which order is left and search for the opposite one.
it is not so simple because the conditions for opening may be 2 on the sell, and then this search will not find anything
Don't duplicate posts in different threads, it's bad form.
I'm sorry, I'll try harder to remember to delete identical posts from different threads,