Zero Divide(문제를 찾았지만 그 이유는 무엇입니까?) - 페이지 4 1234 새 코멘트 Dominic Gilbert 2013.10.02 11:19 #31 네, 강조 표시했기 때문에 보고 있었습니다. 감사합니다! 나는 (내가 이것을 하라고 들었다는 것을 알고 있다!) 특히 전체 공식을 분해하고 그것이 잘못되고 있는 곳까지 따라갈 것이다. 현재로서는 이 0 분할 을 인쇄하는 백 테스트 섹션의 보류 중인 주문에도 사용되지 않을 때 pips_to_ssl에 대해 "0"을 인쇄하는 이유를 이해할 수 없습니다. 나에게 "0"을 주는 것은 pips_to_bsl이 아닙니다. 이상합니다.... Keith Watford 2013.10.02 11:29 #32 이제 4 페이지이고 귀하의 코드가 어디에 숨어 있는지 모르겠습니다 :) Dominic Gilbert 2013.10.02 11:38 #33 double loss_for_1_lot1 = pips_to_ssl/ ts * tv ; if ( loss_for_1_lot1 == 0.0 ) Print ( " ERROR - loss_for_1_lot1 = 0.0 || The formula for this is: " , pips_to_ssl, "/" ,ts, "*" ,tv); 2013.10 . 02 12 : 17 : 04 2001.02 . 12 16 : 00 Trend Fishing - V1 - Notional Lots USDJPYnb,H1: ERROR - loss_for_1_lot1 = 0.0 || The formula for this is: 0 / 0.001 * 0.0001 = 0 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// double pips_to_ssl=SellStopPrice-sellPrice; if (pips_to_ssl == 0 ) Print ( " ERROR - pips_to_ssl = 0 || The formula for this is: " , SellStopPrice, "-" ,sellPrice, "=" ,pips_to_ssl); 2013.10 . 02 12 : 17 : 04 2001.02 . 12 16 : 00 Trend Fishing - V1 - Notional Lots USDJPYnb,H1: ERROR - pips_to_ssl = 0 || The formula for this is: (SellStopPrice) 117.249 - (sellPrice) 117.249 = 0 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// double SellStopPrice = NormalizeDouble (SellStopPriceMath, Digits ); if (SellStopPrice > 0 ) Print ( "SellStopPrice is a NormalizeDouble - This number derives from (SellStopPriceMath):" , SellStopPriceMath); 2013.10 . 02 12 : 28 : 22 2001.02 . 12 16 : 00 Trend Fishing - V1 - Notional Lots USDJPYnb,H1: SellStopPrice is a NormalizeDouble - This number derives from (SellStopPriceMath) = 117.2489 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// double ATR = iATR ( NULL , 60 , 14 , 1 ); double MA = iMA ( NULL , 60 ,MA_Period, 0 , 1 , 0 , 1 ); double SellStopPriceMath = MA + ATR; if ( SellStopPriceMath > 0 ) Print ( "SellStopPriceMath formula is: (MA)" , MA, "+ (ATR)" ,ATR, "=" ,SellStopPriceMath); 2013.10 . 02 12 : 17 : 04 2001.02 . 12 16 : 00 Trend Fishing - V1 - Notional Lots USDJPYnb,H1: SellStopPriceMath formula is: (MA) 117.0668 + (ATR) 0.1821 = 117.2489 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// double ATR_Pad = iATR ( NULL , 60 , 14 , 1 )/ 2 ; double Sell_Pad = NormalizeDouble (ATR_Pad, Digits ); int iTBT_1 = iBarShift( NULL , 60 , triggerBarTime, true ), iLL = iLowest( NULL , 60 , MODE_LOW, iTBT_1 + CandlesBeforeBiasObtained, 0 ); double Sell_Here = Low[iLL] - Sell_Pad; double sellPrice = NormalizeDouble (Sell_Here, Digits ); if ( sellPrice > 0 ) Print ( "sellPrice formula is from: Sell_Here formula: (iLL price)" , Low[iLL], "- (Sell_Pad)" ,Sell_Pad, "=" ,sellPrice); 2013.10 . 02 12 : 17 : 04 2001.02 . 12 16 : 00 Trend Fishing - V1 - Notional Lots USDJPYnb,H1: sellPrice formula is from: Sell_Here formula: (iLL price) 117.34 - (Sell_Pad) 0.091 = 117.249 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// double ATR_Pad = iATR ( NULL , 60 , 14 , 1 )/ 2 ; double Sell_Pad = NormalizeDouble (ATR_Pad, Digits ); 2013.10 . 02 12 : 36 : 24 2001.02 . 12 16 : 00 Trend Fishing - V1 - Notional Lots USDJPYnb,H1: Sell_Pad = 0.091 | which is from ATR_Pad: 0.0911 Ok - 여기에서 BUY_STOP 주문이 실제로 버려지지만 0 나누기 오류는 내 판매 보류 주문 코드에서 파생되는 " 제로 나누기 " 이벤트에서 코드 및 해당 인쇄가 있는 위에서 아래로 오류 순서입니다. ? Dominic Gilbert 2013.10.02 12:10 #34 좋아, 나는 그것을 고쳤고 문제를 분류했다고 생각한다 - 나는 단지 프롬프트와 함께 나를 도와준 모든 사람에게 감사하고 싶다! 정말 감사합니다 :D!! 따라서 기본적으로 이것은 잘못된 것으로 보이는 곳입니다. 참고 사항은 아래에 있습니다. 이제 BUYSTOPS 및 SELLSTOPS에 해당하는 관련 코딩을 있어야 할 위치로 옮겼습니다! //+------------------------------------------------------------------+ //| Order Enter Function | //<< When this was getting called it was conducting all the mathematical formula's irrespective of the pending order! //+------------------------------------------------------------------+ void OrderEntry( int direction) { //Padding for the stop and padding for the entry too. double ATR_Pad = iATR ( NULL , 60 , 14 , 1 )/ 2 ; double Buy_Pad = NormalizeDouble (ATR_Pad, Digits ); double Sell_Pad = NormalizeDouble (ATR_Pad, Digits ); //Get Highest Price in our lookback range and set buy price above it. int iTBT = iBarShift( NULL , 60 , triggerBarTime, true ), iHH = iHighest( NULL , 60 , MODE_HIGH, iTBT + CandlesBeforeBiasObtained, 0 ); double Buy_Here = High[iHH] + Buy_Pad; double buyPrice= NormalizeDouble (Buy_Here, Digits ); //Get Lowest Price in our lookback range and set sell price below it. int iTBT_1 = iBarShift( NULL , 60 , triggerBarTime, true ), iLL = iLowest( NULL , 60 , MODE_LOW, iTBT_1 + CandlesBeforeBiasObtained, 0 ); double Sell_Here=Low[iLL] - Sell_Pad; double sellPrice= NormalizeDouble (Sell_Here, Digits ); //Stop calculations. double ATR = iATR ( NULL , 60 , 14 , 1 ); double MA = iMA ( NULL , 60 ,MA_Period, 0 , 1 , 0 , 1 ); double BuyStopPriceMath = MA - ATR; double SellStopPriceMath = MA + ATR; double BuyStopPrice = NormalizeDouble (BuyStopPriceMath, Digits ); double SellStopPrice = NormalizeDouble (SellStopPriceMath, Digits ); //get our buystop price from below the ma and our takeprofit based on our r:r ratio. double pips_to_bsl=buyPrice-BuyStopPrice; double buy_tp_price=(pips_to_bsl*RewardRatio)+buyPrice; double buy_takeprofit_price= NormalizeDouble (buy_tp_price, Digits ); //get our sellstop price from below the ma and our takeprofit based on our r:r ratio. double pips_to_ssl=SellStopPrice-sellPrice; double sell_tp_price=sellPrice-(pips_to_ssl*RewardRatio); double sell_takeprofit_price= NormalizeDouble (sell_tp_price, Digits ); //Lot calculation - Facilitates Notional and Lots within MT4 - As well as find the tick value relative to the account denomination. double risk_amount = AccountEquity( )*RiskPercent/ 100 ; double Lot_Step = MarketInfo( Symbol (), MODE_LOTSTEP); double ts = MarketInfo( Symbol (), MODE_TICKSIZE); double tv = MarketInfo( Symbol (), MODE_TICKVALUE); double minlot = MarketInfo( Symbol (), MODE_MINLOT); double loss_for_1_lot = pips_to_bsl/ ts * tv ; //Alert(loss_for_1_lot); double LotSize_Buy = MathFloor ( risk_amount / loss_for_1_lot/ Lot_Step) * Lot_Step ; //Alert(LotSize_Buy); double loss_for_1_lot1 = pips_to_ssl/ ts * tv ; //<<<<<<<<<<<<<<<<<<<< THIS WAS RUNNING THE EQUATION EVEN THOUGH IT WAS NOT REQUIRED! //Alert(loss_for_1_lot1); //<<<<<<<<<<<<<<<<<<< THIS IS NOW MOVED TO WITHIN THE PARENTHESIS "DIRECTION == 1". double LotSize_Sell = MathFloor ( risk_amount / loss_for_1_lot1/ Lot_Step) * Lot_Step ; //Alert(LotSize_Sell); //+-------------------------------------------------------------------------------------+ //| Order Buy Function | //+-------------------------------------------------------------------------------------+ //Place a pending buystop if no orders exists. Pending or otherwise. if (direction== 0 ) { ... } // end of if(direction==0) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //+---------------------------------------------------------------------------------------+ //|Order Sell Function | //+---------------------------------------------------------------------------------------+ if (direction== 1 ) { //--Sell--// ... } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1234 새 코멘트 트레이딩 기회를 놓치고 있어요: 무료 트레이딩 앱 복사용 8,000 이상의 시그널 금융 시장 개척을 위한 경제 뉴스 등록 로그인 공백없는 라틴 문자 비밀번호가 이 이메일로 전송될 것입니다 오류 발생됨 Google으로 로그인 웹사이트 정책 및 이용약관에 동의합니다. 계정이 없으시면, 가입하십시오 MQL5.com 웹사이트에 로그인을 하기 위해 쿠키를 허용하십시오. 브라우저에서 필요한 설정을 활성화하시지 않으면, 로그인할 수 없습니다. 사용자명/비밀번호를 잊으셨습니까? Google으로 로그인
네, 강조 표시했기 때문에 보고 있었습니다. 감사합니다! 나는 (내가 이것을 하라고 들었다는 것을 알고 있다!) 특히 전체 공식을 분해하고 그것이 잘못되고 있는 곳까지 따라갈 것이다. 현재로서는 이 0 분할 을 인쇄하는 백 테스트 섹션의 보류 중인 주문에도 사용되지 않을 때 pips_to_ssl에 대해 "0"을 인쇄하는 이유를 이해할 수 없습니다.
나에게 "0"을 주는 것은 pips_to_bsl이 아닙니다. 이상합니다....
좋아, 나는 그것을 고쳤고 문제를 분류했다고 생각한다 - 나는 단지 프롬프트와 함께 나를 도와준 모든 사람에게 감사하고 싶다! 정말 감사합니다 :D!!
따라서 기본적으로 이것은 잘못된 것으로 보이는 곳입니다. 참고 사항은 아래에 있습니다. 이제 BUYSTOPS 및 SELLSTOPS에 해당하는 관련 코딩을 있어야 할 위치로 옮겼습니다!