welcome back traders ally casey here from star wars channel thank you for joining me this video is about answering a couple of questions sent by viewers of the channel and i love these questions as they help other traders who are probably shy to send their questions and they also let you think about puzzles as you know programming is all about solving puzzles so i hope you find them useful and let's jump in welcome back traders ally casey here from start oasis channel thank you for joining me before we continue i would like to ask you to please smash the like button and subscribe hit the notification bell share the video with your friends as this will help the channel a lot i really appreciate it thanks now today's video is about answering a couple of questions sent by viewers of the channel and question one is hi i have one question how do you build a template with fuzzy logic i want to create a fixed variable and the rest with fuzzy logic is this possible sent by hablimos which it's not a name because i think in spanish probably talk or let's talk so let's do let's deal with question number one which is you have like a variable you have an indicator whatever you want to have that and add to it so the easiest way to do this of course you go into algo wizard and you switch the advanced to template when you switch template you know that you don't have any more options so let's do a simple one maybe the close is higher than the clause one bar ago let's say we want this example and then we will make it as a template let's generate randomly from 1 to 10 step 1 so that's the shift that's going to happen so close greater than close one day ago two days ago three days ago so on and so forth and let's confirm and let's save this as a template and you cannot see the template because it's on the other screen but it's saved and now we go to builder and in full setting we pick the strategy template and it's already picked now if we test and i have some tests before i'm going to show you but let's this is the last one just remember so let's test what ha what's happened here okay we got many so free pick this is the first one so let's see the logic so the logic is closed greater than close two bars ago and nine bars ago and eight balls ago this is what we expect the template the sqx builder will follow this template meaning that you cannot add uh fuzzy logic to it there is no way to do that even though it's already picked here and the reason is clear because and the reason is clear because that's the whole reason of the template so then the next way to do this is through a simple strategy default and then when we go to full setting we go to trading uh building blocks and now you can pick any one of these so in case i want to do this one then i have to save this as a custom block so you do the custom block as let's say close or for example i have this one so i highlighted this is this is the candle patterns i have a video there should be a link to it in the corner it's basically custom blocks and that's what you want you want to build your own custom block and then you import them and then they will show in the builder in the blocks okay so let's assume this is the block we want assume you build your own indicator your own pattern your own price action block and let's assume it's this one it's doji so now i want the fuzzy logic to always include doji and other indicators which in this case we have 19 blocks 19 indicators and 22's top limit blocks so if we go back to what to build and in this this case i'm going to pick simple strategy and then you come to strategy style and you pick the fuzzy logic now what is fuzzy logic before we continue i actually built some strategies to show you so the normal strategy let's say we pick this one this is a normal strategy where there is a long entry signal short entry signal as you can see it's very simple in this case it's one condition fuzzy logic picks a number of conditions and then if a fixed percentage of them are true then the signal will happen basically it's like an ensemble of signals let's say you want to combine you know you want the moving average confirming the rsi confirming the adx and but you don't want all of them to be true you want some percentage of them to be true so in this case for example the fuzzy fuzzy logic decided 50 57 of the conditions are true which is two out of four because 50 57 on four conditions that's basically four two and so if two of these are correct then the long entry signal is true so that's what fuzzy logic is and basically the idea is you want let's say to fix this for example i want to always trade on monday and then whatever else and when we do this now like i showed you so now right now i'm picking the doji pattern and let me delete the the these guys and now let's build some strategies so these will be fuzzy logic okay i'm going to stop it and we have some strategies so let's look at the strategies so you can see this one doesn't have the doji block and the next one doesn't have it next one this one also doesn't have it this was this is a different pattern and this one doesn't have it and this one is also doesn't happen so you can see out of of course we only did the three uh five strategies but you can see n of the five none of them had the option the doji but of course if i keep the system running it will generate some strategies with doji pattern so how can we force sqx to have this pattern in all strategies well the current way the only way i know to do it is through forcing sqx to think about the weights so you can see here there is a weight column and if i increase this to let's say 50 that i'm telling sqx treat this 50 times more important than whatever the next block is so if we go i don't know so for example this block so i'm telling sqo x this is 50 times more important so obviously then this block will show up more but there is one caveat to this and i will show you how what let's build some strategies with this and let's see now what we have so you can see this one has doji but it also has two more dojis which are the same and let's pick another one this one doesn't have it this one also has it but this time it's four times and if you check this it is a copy of uh the one before so there is no difference in these dodges because remember unless you want to shift doji that's it but see this one shifted by one and this is shifted by one this one shifted by three and this one shifted by three so this bug in sqx i've seen it before happen even with normal blocks where it repeats the condition and and you can see it here it's repeating this one and also it's repeating this one and then let's check another one here it's alone so this is what we are looking for we are looking for this to be combined with something else here we can also also see only one and here we can also see only one just remember you have to eat through the strategies because some strategies will have a repeated pattern and few strategies will not have the block that you want so the weight does work except that there is this bug where it might repeat the the condition more than once and sometimes it will not have it at all so let me delete this and here i can show you that what i did this is simple strategy this is the close greater than the clause and this is what i'm telling you again because i did the test before and you can see that it repeats the pattern this block i didn't put any shift in it so you can see all of them are one and then when i added the shift it started to repeat them less often and for example this one i forced sqx to use monday and tuesday only and you can see here that there is monday and tuesday and then here you can see that again it repeated monday and it repeated uh sorry it repeated one day three times so obviously all these three are the same and then here it had only uh monday and then here it had only tuesday and here it has monday and tuesday so you can see most of the time it will do what you would like it to do but you just have to eat through the strategies to make sure that you remove the strategies that has the repeated condition like this one now we go to the second question the second question is can you show us a custom project which before it puts the strategies in final data bank weed out losing days basically this is looking for bias so you're looking for the strategies performing let's say really good during the week but it loses on all mondays so you don't want to use mondays the current structure of sqx when you do crosscheck the crosscheck is only filtering the results meaning you cannot change the logic in the cross check so i cannot force sqx to say well this strategy is not performing well on monday then how about you switching off monday but i can tell as qx to filter out the losing strategies on monday meaning don't change the code because i can't change the code but i can let's say at least isolate them isolate them or delete them and the way to do this of course i'm assuming you know how to build the projects and if you don't know there is a video on how to build custom projects but for the sake of speed i'm not going to build the project but i'm going to show you how to add that block to the project so if we go to crosscheck and let's pick i so i put a strategy here so this is a strategy that loses on wednesday and thursday and let's say this is in a data bank full of strategies and i want to get rid of those strategies that loses on some days so then we go to the we go to the cross check we switch on what if simulation and then in the settings we click on trade only in days and then you pick one so for example let's pick monday so monday now is profitable we know monday is profitable and we filter on that the net profit is greater than zero so i'm looking for strategies that have net profit greater than zero and i'm gonna limit that to monday so in this case when i test and retest selected and if i test this this should pass and we can see its pass and remember here you need to put a what if i created this data bank and i you can create this here basically what you want to do is the net profit should be for what if simulation you cannot do a net profit main data because it will not show up you need to show this and this is the net profit so we know now the monday is 1980 and i can prove this to you because if if we go to this to the original strategy we can see monday is 19 0080. so now let me test it on wednesday we should fail so let's go back cross check and let me pick now wednesday and save now if i test and and see in the portfolio it should fail so let's go progress test and it failed of course because it loses money on wednesday 7 344 to be exact and we can check this and it's correct seven thousand so you can add this block in your workflow to test every day of the week so each day of the week will be one block you can add it but then you can save all these strategies in a data bank so mondays are losing it will let's say store them in mondays you create a data bank that's monday you create another databank let's say for tuesday or you put them all in one data bank and these will be the failed strategies that that passed everything else but fails on certain days then you can easily come here like once you have them i know the strategy is good but it shouldn't trade on wednesday then you can bring this back in and change the code to not trade on wednesdays now i know this is a little bit fast but i hope you got the gist of it and maybe in a separate video we will do the whole project separately great you made it to the end of the video thank you for watching i hope you find the video useful as always please do like share subscribe comment hit the notification bell as this will help the channel grow and if you have any questions i'll be happy to answer them through email through the discord channel or for comments on the youtube videos below as always good luck with your trading good luck with your investing stay safe and i'll see you soon [Music] you