This is for advanced programmers or MT4 EA coders.
Why do I get two massively different results by deleting a portion of "non relevant" code?
Example 1 PART 1
Why do I get two massively different results by deleting a portion of "non relevant" code?
Example 1 PART 1
Inserted Code
/////////////////////////////////////////////////////////////////////////////////// // INITAL TRADE OPENING ALGOS // Open new orders based on trading parameters below /////////////////////////////////////////////////////////////////////////////////// if ((Hour() != NTH) && (Hour() != NTH1) && (Hour() != NTH2) && (AlgoType == 1)) { if (((count1D+count2D+count3D+count4D+count5D+count6D) < MP) && (OrdersTotal() < OT1)) { if (Trade1 == true) { if ((iCustom(NULL,0,"MMIndV3",MMIndV3PerT1,1,shift1T1) > 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT1,0,shift2T1) < 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT1,1,shift1T1) != EMPTY_VALUE) && (countL1D == 0)) {fBuy1(); Print("MN1 BUY SIGNAL. MN1 OPEN BUY WAS SENT.");} if ((iCustom(NULL,0,"MMIndV3",MMIndV3PerT1,0,shift1T1) < 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT1,1,shift2T1) > 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT1,1,shift2T1) != EMPTY_VALUE) && (countS1D == 0)) {fSell1(); Print("MN1 SELL SIGNAL. MN1 OPEN SELL WAS SENT.");} } if (Trade2 == true) { if ((iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,1,shift1T2) > 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,0,shift2T2) < 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,1,shift1T2) != EMPTY_VALUE) && (countL2D == 0)) {fBuy2(); Print("MN2 BUY SIGNAL. MN2 OPEN BUY WAS SENT.");} if ((iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,0,shift1T2) < 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,1,shift2T2) > 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,1,shift2T2) != EMPTY_VALUE) && (countS2D == 0)) {fSell2(); Print("MN2 SELL SIGNAL. MN2 OPEN SELL WAS SENT.");} //if ((iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,1,shift1T2) > 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,0,shift1T2) == EMPTY_VALUE) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,0,shift1T2+1) < 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,1,shift1T2+1) == EMPTY_VALUE) && (countL2D == 0)) {fBuy2(); Print("MN2 BUY SIGNAL. MN2 OPEN BUY WAS SENT.");} //if ((iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,0,shift1T2) < 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,1,shift1T2) == EMPTY_VALUE) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,1,shift1T2+1) > 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,0,shift1T2+1) == EMPTY_VALUE) && (countS2D == 0)) {fSell2(); Print("MN2 SELL SIGNAL. MN2 OPEN SELL WAS SENT.");} } if (Trade2 == false) { if ((iCustom(NULL,0,"SuperTrendUpdated",NBRPeriodT2,MultiplierT2,0,STshift1T2) != EMPTY_VALUE) && (iCustom(NULL,0,"SuperTrendUpdated",NBRPeriodT2,MultiplierT2,0,STshift1T2+1) == EMPTY_VALUE) && (countL2D == 0)) {fBuy2(); Print("MN2 BUY SIGNAL. MN2 OPEN BUY WAS SENT.");} if ((iCustom(NULL,0,"SuperTrendUpdated",NBRPeriodT2,MultiplierT2,0,STshift1T2) != EMPTY_VALUE) && (iCustom(NULL,0,"SuperTrendUpdated",NBRPeriodT2,MultiplierT2,0,STshift1T2+1) == EMPTY_VALUE) && (countS2D == 0)) {fSell2(); Print("MN2 SELL SIGNAL. MN2 OPEN SELL WAS SENT.");} } if (Trade3 == true) { if ((iCustom(NULL,0,"MMIndV3",MMIndV3PerT3,1,shift1T3) > 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT3,0,shift2T3) < 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT3,1,shift1T3) != EMPTY_VALUE) && (countL3D == 0)) {fBuy3(); Print("MN3 BUY SIGNAL. MN3 OPEN BUY WAS SENT.");} if ((iCustom(NULL,0,"MMIndV3",MMIndV3PerT3,0,shift1T3) < 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT3,1,shift2T3) > 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT3,1,shift2T3) != EMPTY_VALUE) && (countS3D == 0)) {fSell3(); Print("MN3 SELL SIGNAL. MN3 OPEN SELL WAS SENT.");} } } if (((count1D+count2D+count3D+count4D+count5D+count6D) <= MP2) && (OrdersTotal() < OT2)) { if (Trade4 == true) { if ((iCustom(NULL,0,"VCS",VCSPerT4,ATRT4,KVT4,MODET4,0,shiftT4) != EMPTY_VALUE) && (iCustom(NULL,0,"VCS",VCSPerT4,ATRT4,KVT4,MODET4,0,shiftT4+1) == EMPTY_VALUE) && (countL4D == 0)) {fBuy4(); Print("MN4 BUY SIGNAL. MN4 OPEN BUY WAS SENT.");} if ((iCustom(NULL,0,"VCS",VCSPerT4,ATRT4,KVT4,MODET4,0,shiftT4) != EMPTY_VALUE) && (iCustom(NULL,0,"VCS",VCSPerT4,ATRT4,KVT4,MODET4,0,shiftT4+1) == EMPTY_VALUE) && (countS4D == 0)) {fSell4(); Print("MN4 SELL SIGNAL. MN4 OPEN SELL WAS SENT.");} } if (Trade4 == false) { if ((iCustom(NULL,0,"VCS",VCSPerT4,ATRT4,KVT4,MODET4,0,shiftT4) != EMPTY_VALUE) && (iCustom(NULL,0,"VCS",VCSPerT4,ATRT4,KVT4,MODET4,0,shiftT4+1) == EMPTY_VALUE) && (countL4D == 0)) {fBuy4(); Print("MN4 BUY SIGNAL. MN4 OPEN BUY WAS SENT.");} if ((iCustom(NULL,0,"VCS",VCSPerT4,ATRT4,KVT4,MODET4,1,shiftT4) != EMPTY_VALUE) && (iCustom(NULL,0,"VCS",VCSPerT4,ATRT4,KVT4,MODET4,1,shiftT4+1) == EMPTY_VALUE) && (countS4D == 0)) {fSell4(); Print("MN4 SELL SIGNAL. MN4 OPEN SELL WAS SENT.");} } if (Trade5 == true) { if ((iCustom(NULL,0,"VCS",VCSPerT5,ATRT5,KVT5,MODET5,0,shiftT5) != EMPTY_VALUE) && (iCustom(NULL,0,"VCS",VCSPerT5,ATRT5,KVT5,MODET5,0,shiftT5+1) == EMPTY_VALUE) && (countL5D == 0)) {fBuy5(); Print("MN5 BUY SIGNAL. MN5 OPEN BUY WAS SENT.");} if ((iCustom(NULL,0,"VCS",VCSPerT5,ATRT5,KVT5,MODET5,1,shiftT5) != EMPTY_VALUE) && (iCustom(NULL,0,"VCS",VCSPerT5,ATRT5,KVT5,MODET5,1,shiftT5+1) == EMPTY_VALUE) && (countS5D == 0)) {fSell5(); Print("MN5 SELL SIGNAL. MN5 OPEN SELL WAS SENT.");} } if (Trade6 == true) { if ((iCustom(NULL,0,"VCS",VCSPerT6,ATRT6,KVT6,MODET6,0,shiftT6) != EMPTY_VALUE) && (iCustom(NULL,0,"VCS",VCSPerT6,ATRT6,KVT6,MODET6,0,shiftT6+1) == EMPTY_VALUE) && (countL6D == 0)) {fBuy6(); Print("MN6 BUY SIGNAL. MN6 OPEN BUY WAS SENT.");} if ((iCustom(NULL,0,"VCS",VCSPerT6,ATRT6,KVT6,MODET6,1,shiftT6) != EMPTY_VALUE) && (iCustom(NULL,0,"VCS",VCSPerT6,ATRT6,KVT6,MODET6,1,shiftT6+1) == EMPTY_VALUE) && (countS6D == 0)) {fSell6(); Print("MN6 SELL SIGNAL. MN6 OPEN SELL WAS SENT.");} } } } // Just Raw Signals Below if ((Hour() != NTH) && (Hour() != NTH1) && (Hour() != NTH2)) { if ((iCustom(NULL,0,"MMIndV3",MMIndV3PerT1,1,shift1T1) > 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT1,0,shift2T1) < 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT1,1,shift1T1) != EMPTY_VALUE)) {Print("Raw Buy Signal MN1. ", Open[0]); GlobalVariableSet("RSig",1);} if ((iCustom(NULL,0,"MMIndV3",MMIndV3PerT1,0,shift1T1) < 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT1,1,shift2T1) > 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT1,1,shift2T1) != EMPTY_VALUE)) {Print("Raw Sell Signal MN1. ", Open[0]); GlobalVariableSet("RSig",-1);} if ((iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,1,shift1T2) > 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,0,shift2T2) == EMPTY_VALUE) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,0,shift1T2+1) < 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,1,shift2T2+1) == EMPTY_VALUE)) {Print("Raw Buy Signal MN2. ", Open[0]); GlobalVariableSet("RSig",1);} if ((iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,0,shift1T2) < 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,1,shift2T2) == EMPTY_VALUE) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,1,shift1T2+1) > 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT2,0,shift2T2+1) == EMPTY_VALUE)) {Print("Raw Sell Signal MN2. ", Open[0]); GlobalVariableSet("RSig",-1);} if ((iCustom(NULL,0,"MMIndV3",MMIndV3PerT3,1,shift1T3) > 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT3,0,shift2T3) < 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT3,1,shift1T3) != EMPTY_VALUE)) {Print("Raw Buy Signal MN3. ", Open[0]); GlobalVariableSet("RSig",1);} if ((iCustom(NULL,0,"MMIndV3",MMIndV3PerT3,0,shift1T3) < 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT3,1,shift2T3) > 0) && (iCustom(NULL,0,"MMIndV3",MMIndV3PerT3,1,shift2T3) != EMPTY_VALUE)) {Print("Raw Sell Signal MN3. ", Open[0]); GlobalVariableSet("RSig",-1);} if ((iCustom(NULL,0,"VCS",VCSPerT4,ATRT4,KVT4,MODET4,0,shiftT4) != EMPTY_VALUE) && (iCustom(NULL,0,"VCS",VCSPerT4,ATRT4,KVT4,MODET4,0,shiftT4+1) == EMPTY_VALUE)) {Print("Raw Buy Signal MN4. ", Open[0]); GlobalVariableSet("RSig",1);} if ((iCustom(NULL,0,"VCS",VCSPerT4,ATRT4,KVT4,MODET4,0,shiftT4) != EMPTY_VALUE) && (iCustom(NULL,0,"VCS",VCSPerT4,ATRT4,KVT4,MODET4,0,shiftT4+1) == EMPTY_VALUE)) {Print("Raw Sell Signal MN4. ", Open[0]); GlobalVariableSet("RSig",-1);} if ((iCustom(NULL,0,"VCS",VCSPerT4,ATRT4,KVT4,MODET4,0,shiftT4) != EMPTY_VALUE) && (iCustom(NULL,0,"VCS",VCSPerT4,ATRT4,KVT4,MODET4,0,shiftT4+1) == EMPTY_VALUE)) {Print("Raw Buy Signal MN4. ", Open[0]); GlobalVariableSet("RSig",1);} if ((iCustom(NULL,0,"VCS",VCSPerT4,ATRT4,KVT4,MODET4,1,shiftT4) != EMPTY_VALUE) && (iCustom(NULL,0,"VCS",VCSPerT4,ATRT4,KVT4,MODET4,1,shiftT4+1) == EMPTY_VALUE)) {Print("Raw Sell Signal MN4. ", Open[0]); GlobalVariableSet("RSig",-1);} if ((iCustom(NULL,0,"VCS",VCSPerT5,ATRT5,KVT5,MODET5,0,shiftT5) != EMPTY_VALUE) && (iCustom(NULL,0,"VCS",VCSPerT5,ATRT5,KVT5,MODET5,0,shiftT5+1) == EMPTY_VALUE)) {Print("Raw Buy Signal MN5. ", Open[0]); GlobalVariableSet("RSig",1);} if ((iCustom(NULL,0,"VCS",VCSPerT5,ATRT5,KVT5,MODET5,1,shiftT5) != EMPTY_VALUE) && (iCustom(NULL,0,"VCS",VCSPerT5,ATRT5,KVT5,MODET5,1,shiftT5+1) == EMPTY_VALUE)) {Print("Raw Sell Signal MN5. ", Open[0]); GlobalVariableSet("RSig",-1);} if ((iCustom(NULL,0,"VCS",VCSPerT6,ATRT6,KVT6,MODET6,0,shiftT6) != EMPTY_VALUE) && (iCustom(NULL,0,"VCS",VCSPerT6,ATRT6,KVT6,MODET6,0,shiftT6+1) == EMPTY_VALUE)) {Print("Raw Buy Signal MN6. ", Open[0]); GlobalVariableSet("RSig",1);} if ((iCustom(NULL,0,"VCS",VCSPerT6,ATRT6,KVT6,MODET6,1,shiftT6) != EMPTY_VALUE) && (iCustom(NULL,0,"VCS",VCSPerT6,ATRT6,KVT6,MODET6,1,shiftT6+1) == EMPTY_VALUE)) {Print("Raw Sell Signal MN6. ", Open[0]); GlobalVariableSet("RSig",-1);} } return; } /////////////////////////////////////////////////////////////////////////////////// // END OF INITAL TRADE OPENING ALGOS ///////////////////////////////////////////////////////////////////////////////////