Need help with an error

 

I am a beginner with mql4.  I dabbled with mql4 a couple of months ago but stopped.  I am know back and I am trying to code an EA that uses the AuthorizedSSBODynamicBreakoutBoxFinalEdition indicator from over in ForexFactory.  It was pretty easy to get my ea to trade with the indicator, however, there is an option with the indicator to use martingale.  So, I have been trying to get my EA to use the martingale strategy.  However, I am getting the Error 4051 which I think means that my ea is returning a lot size of 0.

 I am not getting any errors when I compile just when I try to back test.  To be honest this is my first time using other functions than int start() and int init() so I probably got that all messed up?

I just do not understand why my LotsOptimized function(which I used from an EA I found in the code base) is returning Mlot as zero.  

So, can you please help me understand how to get this to work?

The EA and include library is attached below since it would not let me post the source code here because it was too long. 

--Thanks! 

Files:
 
There are allot of reasons and I don't even know where to start. I don't recommend building an EA by cut_&_paste other people's codes. I recommend the Book. https://book.mql4.com//.
 
QuasarCreator:

I am a beginner with mql4.  I dabbled with mql4 a couple of months ago but stopped.  I am know back and I am trying to code an EA that uses the AuthorizedSSBODynamicBreakoutBoxFinalEdition indicator from over in ForexFactory.  It was pretty easy to get my ea to trade with the indicator, however, there is an option with the indicator to use martingale.  So, I have been trying to get my EA to use the martingale strategy.  However, I am getting the Error 4051 which I think means that my ea is returning a lot size of 0.

 I am not getting any errors when I compile just when I try to back test.  To be honest this is my first time using other functions than int start() and int init() so I probably got that all messed up?

I just do not understand why my LotsOptimized function(which I used from an EA I found in the code base) is returning Mlot as zero.  

So, can you please help me understand how to get this to work?

The EA and include library is attached below since it would not let me post the source code here because it was too long. 

--Thanks! 

ERR_INVALID_FUNCTION_PARAMVALUE 4051 Invalid function parameter value.

 

Which function call is giving the error ? 

 
Your functions CloseAllBuyOrders and CloseAllSellOrders won't work correctly,  you must count down:  Loops and Closing or Deleting Orders
 

I was able to fix it.  I was getting an 'A Ending Program bracket is expected' error so I just put another bracket at the end of the program like an idiot.

Sorry, for wasting your time!  

 Next time, I will remember to give myself an extra day or two to look at my code before I post here. 

 

P.S.  Thank you RaporUK for pointing that out!  I think I have fixed those functions now. 

Reason: