Ja, ich habe mir das angeschaut, weil Sie das hervorgehoben haben, danke! Ich werde aufzubrechen (die ich weiß, ich habe gesagt, dies zu tun!) speziell die gesamte Formel und folgen Sie es nach unten, wo es falsch geht. Im Moment kann ich nicht verstehen, warum es eine "0" für pips_to_ssl druckt, wenn dies nicht einmal für die schwebende Ordnung auf dem Abschnitt der Backtesting, wo es diese Null teilen druckt verwendet wird...
Es ist nicht pips_to_bsl, das mir die "0" gibt... Seltsam....
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.0212:17:042001.02.1216:00 Trend Fishing - V1 - Notional Lots USDJPYnb,H1: ERROR - loss_for_1_lot1 = 0.0 || The formula forthis 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.0212:17:042001.02.1216:00 Trend Fishing - V1 - Notional Lots USDJPYnb,H1: ERROR - pips_to_ssl = 0 || The formula forthis 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.0212:28:222001.02.1216: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.0212:17:042001.02.1216: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.0212:17:042001.02.1216: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.0212:36:242001.02.1216:00 Trend Fishing - V1 - Notional Lots USDJPYnb,H1: Sell_Pad = 0.091 | which is from ATR_Pad: 0.0911
Ok - Also hier ist es in der Reihenfolge der Fehler von oben nach unten mit dem Code und die entsprechenden Drucke im Falle von "Null-Divide", wo durch eine BUY_STOP Bestellung ist eigentlich herausgeworfen, noch die Null-Divide-Fehler ist von meinem Verkauf schwebende Bestellung Code?
Ok, ich glaube, ich habe das Problem behoben - ich möchte mich einfach bei allen bedanken, die mir bei den Aufforderungen geholfen haben! Ich weiß das wirklich zu schätzen :D!!
Also, im Grunde ist dies, wo es scheint gewesen falsch - die Notizen sind unten - Ich habe jetzt die relevanten Kodierung, die BUYSTOPS und SELLSTOPS entspricht, wo sie sein sollte!
//+------------------------------------------------------------------+//| 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--//
...
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Wenn Sie kein Benutzerkonto haben, registrieren Sie sich
Erlauben Sie die Verwendung von Cookies, um sich auf der Website MQL5.com anzumelden.
Bitte aktivieren Sie die notwendige Einstellung in Ihrem Browser, da Sie sich sonst nicht einloggen können.
Sie sind angemeldet. Die Zwei-Faktor-Authentifizierung wurde deaktiviert. Richten Sie sie erneut ein und scannen Sie einen neuen QR-Code oder fahren Sie mit deaktivierter Zwei-Faktor-Authentifizierung fort.
Ja, ich habe mir das angeschaut, weil Sie das hervorgehoben haben, danke! Ich werde aufzubrechen (die ich weiß, ich habe gesagt, dies zu tun!) speziell die gesamte Formel und folgen Sie es nach unten, wo es falsch geht. Im Moment kann ich nicht verstehen, warum es eine "0" für pips_to_ssl druckt, wenn dies nicht einmal für die schwebende Ordnung auf dem Abschnitt der Backtesting, wo es diese Null teilen druckt verwendet wird...
Es ist nicht pips_to_bsl, das mir die "0" gibt... Seltsam....
Ok, ich glaube, ich habe das Problem behoben - ich möchte mich einfach bei allen bedanken, die mir bei den Aufforderungen geholfen haben! Ich weiß das wirklich zu schätzen :D!!
Also, im Grunde ist dies, wo es scheint gewesen falsch - die Notizen sind unten - Ich habe jetzt die relevanten Kodierung, die BUYSTOPS und SELLSTOPS entspricht, wo sie sein sollte!