Hi,
I try to code EA that can automatically get range of stoploss, but still not work.
Here is my code, please help !
-
Stop loss is a price not a range. Question makes no sense.
-
“Doesn't work” is meaningless — just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires — meaningless.
How To Ask Questions The Smart Way. (2004
When asking about code -
Your loop makes no sense to me. Until you can state what you want in concrete terms, it can not be coded.
-
You have an infinite loop.
Range of stoploss for what? Opened positions?
i want to auto calculated open lot with fix risk% from balance, i need to find range pips to get lot
here is my another code to combined with get range function
// To Compute a lot RefreshRates(); double price=Ask; double SLos = NormalizeDouble(price-GetSLPip()*Point, _Digits); if (Use_MM_Auto_Lot) lots1 = MMComputeRisk(RiskTrade, MathAbs(price-SLos), BrokerComm); //Open AutoLot Function //-------------------------------------------------------------------------------------------------------------- int GetSLPip() { int pips = 0; double p = 0; double delta=50; for (int i=0; i<=delta; i++) { // Counting Pips for SL Value double HighSL = MathAbs (High[1]+3*Point); double LowSL = MathAbs (Low[1]-3*Point) ; double pipSLB = MathAbs (Open[0]-LowSL); double pipSLS = MathAbs (HighSL - Open[0]); if (Close[1]>Open[2]) { p = MathAbs (Open[0]-LowSL) / Point; //pips = pips + NormalizeDouble(p,0); pips++; } if (Close[1]<Open[2]) { p = MathAbs (HighSL - Open[0])/ Point; //pips = pips + (NormalizeDouble(p,0)); pips++; } } Print("Error Get SL Pips : ",GetLastError()); return(pips); } //------------------------------------------------------------------- double MMComputeRisk(double RiskPercent, double sl, double comm) { double MMBalance, MMRiskMoney; double MMMaxLot=MarketInfo( _Symbol, MODE_MAXLOT ); double MMMinLot=MarketInfo( _Symbol, MODE_MINLOT ); double MMLotStep= MarketInfo( _Symbol, MODE_LOTSTEP ); double MMTickValue = MarketInfo( _Symbol, MODE_TICKVALUE); double MMTickSize = MarketInfo( _Symbol, MODE_TICKSIZE); int lotdigits=0; do { lotdigits++; MMLotStep*=10; }while(MMLotStep<1); MMBalance = MathMin(AccountBalance(), AccountEquity()); MMRiskMoney=MMBalance*RiskPercent/100; double lot = MMRiskMoney / ( sl * ( MMTickValue / MMTickSize ) + comm ); lot=NormalizeDouble( MathFloor(lot*MathPow(10,lotdigits))/MathPow(10,lotdigits), lotdigits ); if( lot > MMMaxLot ){ lot=MMMaxLot; } if( lot < MMMinLot ){ lot=MMMinLot; } return NormalizeDouble( lot, lotdigits ); }
i want to auto calculated open lot with fix risk% from balance, i need to find range pips to get lot
here is my another code to combined with get range function
with this code i get error >>> Get SL Pips = 0
i try another code function to get range in pips (GetSLPips) than first code of this topic
what error of this code? i still dont get fixed of this
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I try to code EA that can automatically get range of stoploss, but still not work.
Here is my code, please help !