1 (edited by hannahis 2015-09-16 06:08:55)

Topic: Error in maximum position allowed

Hi Popov,

1. The maximum position is set at "20" in default mode.
2. Under the "additional entry signal" -  "next same direction signal" is set as "nothing"

Problem arise when:

1. I exported My EA to MT4 in the previous and default setting mentioned above.  Then later I decided to made the following changes:
2. When I made changes to my EA, such as
a) Change the maximum position to "4"
b) change the "additional entry signal" to "winner"
c) export the EA again and refresh the MT4

Problem observed:
1.  The EA started to add new positions for "next same direction signal"
2.  However the EA didn't stop at the new maximum position such as "4"
3.  Instead the EA follow the default "20" as maximum position.

In the past, whenever I made changes to my EA, all I need is re-export my EA and "refresh" my MT4.  I don't have to "re set up" my EA all over again (imagine if I need to do that for hundreds of EA each time I adjust the lots or SL or BE etc). 

Suggestions:
1. Can this issue be resolved back to the past, whereby each time I refresh the MT4, the EA follows the new setting and not the default ones.  Just like the SL, BE and TP settings, they are automatically refreshed to the new parameters/settings. 

Whenever I load my EA in MT4, I can see that "maximum lot" option is there (maybe you left it there for people to make changes without having the need to adjust it in FSB Pro).  Whereas the SL, TP and BE options are not reflected and changes have to be made via FSB Pro.  May I suggest that the maximum position option be treated similar to the SL, BE and TP features whereby it will be automatically refreshed to the new settings without the need for me to re set up the EA in the MT4 each time I make changes to the maximum position.

If for some reasons my above request cannot be done.  At least I suggest that it be kept as "0", and highlight "20" red colour if you want to inform user that "20" is the maximum lots, just like SL, BE and TP. 

In this way, if I refreshed the EA (many of them) and accidentally missed out 1 EA and failed to delete the old set up and re-set up the EA again, at least I won't be "punished" heavily for my forgetfulness/mistakes and resulting in my EA buying up 20 lots...that would be a painful lesson in real trading and also for new users who may assumed that all the changes are reflected whenever the MT4 is "refreshed".

Thanks

Re: Error in maximum position allowed

Are you sure you run the correct expert.

I just checked and found out that the Max lots are exporting properly to the Expert Advisor.

http://s28.postimg.org/mwbuiio5l/screenshot_1203.jpg

3 (edited by hannahis 2015-09-16 06:26:25)

Re: Error in maximum position allowed

Is this a new set up when it is exported correctly?  I don't have problem when the EA is set up initially and it is exported correctly in the 1st attempt.  However, it is when I made changes to the set up.

My problem is when I made changes to the maximum position (later and then refresh the MT4) and the changes to the maximum position was not reflected.  Not during a new set up.

Re: Error in maximum position allowed

Please take a look at the Control Panel -> Expert Advisor tab.

There are two option for setting the re-export behavior. If you have the first option set, FSB will override the old version  of the file. The second option lest the FSB creating a new file with a (1) suffix.

Be sure you have the first option on if you want to override your old expert.

http://s28.postimg.org/4uspkpu4p/screenshot_1204.jpg

5 (edited by hannahis 2015-09-16 19:12:36)

Re: Error in maximum position allowed

Hi Popov,

Yes, I've chosen the option to over ride the old file.

I don't think you truly understood my earlier explanation.  I am not referring to new set up when you choose the "additional entry signal" (this is working fine).  I am referring to changes made to old EA (i.e. add new position or increase the number of additional position from 4 to 8 etc).


Here are my steps, I hope it will make my explanation clearer. 

Step 1. I am currently running my EA. (originally with No "additional entry signal")
Step 2. Then I changed the same EA to add 4 lots for "next same direction" 
Step 3. I re-export the EA and "refresh" the MT4 (i.e. my old EA is still running/operating in the MT4)

After refresh, when I opened my currently running EA and check the EA properties in the MT4, the  maximum position allowed still remained as 20 (as before).

I hope you understand the above procedure and the problem I'm encountering.

I know that if after I've made the changes to the add position on next same signal,
and if I add in step 4 (i.e. re set up, then there won't be any problem).

1. I am currently running my EA. (originally with no "additional entry signal")
2. Then I changed the same EA to add 4 lots for "next same direction" 
3. I re-export the EA and "refresh" the MT4 (i.e. my old EA is still running/operating in the MT4)
4. Deleted the old EA currently running in the MT4 and re set up the EA again. (in the past, I don't need to do this step).

Re: Error in maximum position allowed

Can you reproduce the issue? If you can make screenshot of the FSB settings and the EA settings with the different parameters?

FSB has one algorithm for exporting Expert Advisor. It is not possible the first time to export it correctly, but the second time to export it wrong.

I'm 100 sure that the problem is that MT doesn't recover the EA settings correctly. I've read in the http://www.stevehopwoodforex.com/phpBB3/index.php forum that we have to never rely on that.

I can help you only if you reproduce a bug in FSB and post the exact steps for reproducing, the expert and the screenshots of all settings.

Step 3. I re-export the EA and "refresh" the MT4 (i.e. my old EA is still running/operating in the MT4)

You should never refresh a working EA especially on a live account. The EA has tens of parameters in the MT memory out of the input parameters. MT will not recover them.

I change my experts only at a moment when there is no open positions. I do it by removing the EA from the chart and attaching it again and preferably on Saturday or on Sunday when the market is closed. And only if the FSB backtester doesn't show an open position at that time.

Re: Error in maximum position allowed

cold boot is required to change EA  ie remove EA, power down the system, wait a few minutes, restart system then add new ea

MT4  does not go away easily

My 'secret' goal is to push EA Studio until I can net 3000 pips per day....

Re: Error in maximum position allowed

Yesterday I lost 1 hour trying to make the new version of the bridge running without success. Finally I restarted MT and it appeared that the bridge is working flawlessly. 

However, I must say that the latest versions of the MQL language are much better than before. I almost decided making a self-generating, optimizing and trading expert !!!

9 (edited by hannahis 2015-09-18 21:33:32)

Re: Error in maximum position allowed

Popov wrote:

. I almost decided making a self-generating, optimizing and trading expert !!!

Cool, with your talent and expertise, you should go for it!  Whereas for me, I can only dream about it smile

I have always been hoping and dreaming a EA constantly optimizing based on current and ongoing market data.  I only wished I have your set of skills.

Re: Error in maximum position allowed

Hi Popov,

Can you consider changing the maximum lot default to "0" instead of "20" so that if in any case because of bug issue, the EA would not end up adding 20 lots.

Re: Error in maximum position allowed

hannahis wrote:

Hi Popov,

Can you consider changing the maximum lot default to "0" instead of "20" so that if in any case because of bug issue, the EA would not end up adding 20 lots.

EA has no default settings. All EA parameters come from the strategy you export.

You have to adjust it in any case. The Max Lots cannot be zero. If it make it lower than the entry amount, the strategy will not trade at all.

12 (edited by hannahis 2015-09-19 19:10:02)

Re: Error in maximum position allowed

Hi Popov,

Yes, I realised can't be "0" but at least "1" or do an auto calculation based on (i.e. this amount will change according to) the in put for A) "Entry amount for a new position and B)"additional entry signal"

Eg 1.  If Entry amount for new position is "1" and no "additional entry signal" is chosen, then the maximum amount is "1"

Eg 2. If Entry amount for new position is "1" and "additional entry signal", "winner" and "amount to add on position" is "1", then the maximum amount is "1+1=2 or manual input to 4"


Although you said that there isn't any default for maximum position allowed.  When I open a new strategy in the FSB Pro, the maximum position amount is set at "20" already.

And when I open the EA properties in the MT4, the maximum position allowed is set at "20" too (this is fine when the "additional same direction signal" is set as "nothing", the EA will follow the amount set by "Entry amount for a new position". 

However, in the event of bug issue such as my case, whereby I choose "additional entry signal" as winner and "amount to add position" is 1 and the maximum is 4.  And because of the bug issue, the MT4 take into account the instruction to add position but didn't update the "4" lots as maximum but remain in the default "20" and hence, add 20 positions instead of 4.  Hence, I thought for safety issue, can you either consider to change the "default" setting 20 to something else be it 1 or auto calculation? or allow the user to change this setting manually (as in the current case, the only difference is that "20" is not the preset number)

I rather the preset maximum number be set at 1 than 20 and then let the user adjust accordingly.  Because in event of a bug issue, 20 lots opened unintentionally is a disaster.  I hope you understand what I'm driving at.  You always looked into safety issue.  And I think it is good to prevent my case from repeating again although, it is no fault of FSB Pro but as you mentioned the bug lies with the MT4.  But for user protection, it's good to look into how to minimize the potential danger if bug issue arise again.

Re: Error in maximum position allowed

And because of the bug issue, the MT4 take into account the instruction to add position but didn't update the "4" lots as maximum but remain in the default "20"

The EA does not have default number of max lots. The number you see is exported from FSB. If you see 20 in the EA, it means that you have exported 20 form FSB. No mater what I set as default value, it requires attention and change before exporting.

I just made the effort to search the EA code for number 20. It appears on two places only in the EA code and both of these are not related to the max entry lots.

14 (edited by hannahis 2015-09-19 19:19:31)

Re: Error in maximum position allowed

That's weird, because when I click on "New Strategy" tab in the FSB Pro, under the "Maximum position amount" [lot], the preset value is "20".

15 (edited by hannahis 2015-09-19 19:22:04)

Re: Error in maximum position allowed

This is the new strategy default screen shot, showing the preset "20" under the "maximum position amount"

Post's attachments

maximum position allowed.png 83.15 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Error in maximum position allowed

The screenshot is from FSB. It has default value 20 for Max Lots.

The expert code is here: PopovMP/FSB_Expert_Advisor_Code. It doesn't have Max Value settings.

The only way the number 20 to appear to the EA is to be exported from FSB. During the export the program replaces the string 77702 with the real settings.

// -----------------------    External variables   ----------------------- //

extern double Entry_Amount    = 77701; // Amount for a new position #TRADEUNIT#
extern double Maximum_Amount  = 77702; // Maximum position amount [lot]
extern double Adding_Amount   = 77703; // Amount to add on addition #TRADEUNIT#
extern double Reducing_Amount = 77704; // Amount to close on reduction #TRADEUNIT#

See: https://github.com/PopovMP/FSB_Expert_A … rt_MT4.mq4

THE ONLY WAY TO SEE 20 IN THE EA IS TO EXPORT IT FROM FSB.

Your EA cannot fabricate this number alone.

Re: Error in maximum position allowed

Yes, I agree with you that the EA doesn't fabricate this number.

Most of the time, if I don't use the "additional entry signal", I leave the "maximum amount allowed" at the preset value, "20" as it is and then export the EA.  Hence, the export EA will reflect "20" for maximum amount allowed but will only trade 1 lot.

The problem arise, when I later decided to change this same EA and turn on the "additional entry signal" to "winner" and I change the "maximum amount allowed" to 4 Lots.  But because of the bug issue in the MT4, the MT4 didn't update the lot to 4 during refresh function but remain at the previous "20".  Hence, I was hoping that if you put the preset value instead of "20" to "1" or "5", then at least the error won't be so damaging to my trading account, when the bug arise.

I am not sure you whether you understand my explanation/suggestion.

Re: Error in maximum position allowed

There is very easy solution to you request. Simply set what ever default settings you need and save a Template. Later, when you need a new strategy, open the saved template.

http://s28.postimg.org/v9vs1s8g9/screenshot_1210.jpg

19 (edited by hannahis 2015-09-20 09:20:07)

Re: Error in maximum position allowed

Thanks.  Of course another simplest solution is to change the preset every time and not just leave it as it is in the preset value "20", even if I'm not using the "additional entry signal".

I guess that defeats the purpose of me raising my concern.