Remember the lowest low and its bar index.
double lowestLow=99999; int lowestLowBar=-1; for(int i=0; i<=Array_Period;i++) if(High[i]>SL_Area && Low[i]<SL_Area) { if(Low[i]<lowestLow) { lowestLow=Low[i]; lowestLowBar=i; } ...
lippmaje:
Remember the lowest low and its bar index.
Great, THX !!!!
int SL_Diff = int(iATR(Symbol(),Period(),14,0)*MarketInfo(Symbol(),MODE_LOTSIZE)*2); double SL_Area_BUY = Bid-SL_Diff*_Point; double SL_Area_SELL = Ask+SL_Diff*_Point; //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// int Check_Candles = 1000; double Lowest_Low_Price = 999, Highest_High_Price = 0; int Lowest_Low_Bar = 999, Highest_High_Bar = 999; //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// for(int i=0; i<=Check_Candles; i++) if(High[i]>SL_Area_BUY && Low[i]<SL_Area_BUY && Low[i]<Lowest_Low_Price) { Lowest_Low_Price=Low[i]; Lowest_Low_Bar=i; }; // check for BUY Orders for(int i=0; i<=Check_Candles; i++) if(High[i]>SL_Area_SELL && Low[i]<SL_Area_SELL && High[i]>Highest_High_Price) { Highest_High_Price=High[i]; Highest_High_Bar=i; }; // check for SELL Orders //====================================================================================================================================================================================================// if(draw_StopLoss==true && NewBar==true) { ObjectDelete("SL_Area_BUY"); ObjectCreate("SL_Area_BUY", OBJ_HLINE,0,Time[0],SL_Area_BUY); ObjectSetInteger(0,"SL_Area_BUY", OBJPROP_COLOR,clrRed); ObjectSetInteger(0,"SL_Area_BUY", OBJPROP_STYLE,STYLE_DOT); ObjectSetInteger(0,"SL_Area_BUY",0, OBJPROP_WIDTH,4); //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// ObjectDelete("SL_Level_BUY"); ObjectCreate("SL_Level_BUY", OBJ_HLINE,0,Time[0],Lowest_Low_Price); ObjectSetInteger(0,"SL_Level_BUY", OBJPROP_COLOR,clrRed); ObjectSetInteger(0,"SL_Level_BUY", OBJPROP_STYLE,STYLE_SOLID); ObjectSetInteger(0,"SL_Level_BUY",0, OBJPROP_WIDTH,5); //====================================================================================================================================================================================================// ObjectDelete("SL_Area_SELL"); ObjectCreate("SL_Area_SELL", OBJ_HLINE,0,Time[0],SL_Area_SELL); ObjectSetInteger(0,"SL_Area_SELL", OBJPROP_COLOR,clrRed); ObjectSetInteger(0,"SL_Area_SELL", OBJPROP_STYLE,STYLE_DOT); ObjectSetInteger(0,"SL_Area_SELL",0, OBJPROP_WIDTH,4); //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// ObjectDelete("SL_Level_SELL"); ObjectCreate("SL_Level_SELL", OBJ_HLINE,0,Time[0],Highest_High_Price); ObjectSetInteger(0,"SL_Level_SELL", OBJPROP_COLOR,clrRed); ObjectSetInteger(0,"SL_Level_SELL", OBJPROP_STYLE,STYLE_SOLID); ObjectSetInteger(0,"SL_Level_SELL",0,OBJPROP_WIDTH,5); };
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Hi Guys,
I would like to use an ATR to define a StopLossArea, afterwards I would like to search for all Bars/Candles that are crossing this StopLossArea.
In the next step, I would like to get the LowestLow from those crossing Candles as my final StopLoss.
Unfortunately I'm not sure how exact I could do that.
Attached I tried to loop trough the past 1000 Bars/Candles and store the Low[] of those, that are crossing the StopLossArea.
But as of there, I have no idea how I can select out of them, the LowestLow.
Does any body has a tipp for me? Or is my assumption/code completely bullsh** ? thx in advance