Smart Money Concepts (SMC) – Strategy codinghelp
Forums › ProRealTime English forum › ProOrder support › Smart Money Concepts (SMC) – Strategy codinghelp
- This topic has 6 replies, 4 voices, and was last updated 2 months ago by SnorreDK.
-
-
08/09/2024 at 6:47 PM #236307
Ivan’s indicator SMC is far too interesting and advanced not to be used in a strategy. Unfortunately, my skills aren’t sufficient to fully harness the indicator’s potential. Is there anyone here who wants to give it a try?
Smart Money Concepts (SMC)
https://www.prorealcode.com/prorealtime-indicators/smart-money-concepts-smc-indicator/
08/18/2024 at 8:04 AM #23646008/18/2024 at 12:24 PM #236468You have top use CALL to get data returned from the indicator. It requires 10 input paraemters and returns none:
1CALL "PRC_Smart Money Concepts"[50, 1, 1, 1, 1, 1, 1, 5, 0, 1]The web page in the link you posted explains those parameters (see also my attached pic).
In any case, since it returns no data, it’s impossible to use it in a strategy, it’s just for manual trading.
To be able to use it in a strategy you need to specify what signals you want to be returned.1 user thanked author for this post.
08/18/2024 at 12:53 PM #236473I think, you should allow Ivan some time as the indicator seems complex to convert into a strategy, especially if you consider different timeframes showing different demand / supply zones and then how to define which one to target.
1 user thanked author for this post.
08/25/2024 at 6:23 PM #23671208/30/2024 at 12:28 PM #236896Hi. This would take quite a few hours 🙂
We can do something quick. For example use the internal structure change signals to enter longs and shorts.Copy and paste the indicator into the backtester. You will see that there are errors due to the drawing functions.
We do a quick clean up by removing the drawing lines.At the end of the code we enter the buy/sell orders:
12345678910111213mytopsignal=$itopy[m]mybotsignal=$iboty[s]if mytopsignal<>mytopsignal[1] and $ichoch[m]=1 thenbuy 10 contract at marketset stop %loss 5set target %profit 5endif//-----------------------------------------------------------------------------//if mybotsignal<>mybotsignal[1] and $ibotchoch[s]=1 thensellshort 10 contract at marketset stop %loss 5set target %profit 5endifThe following code will give you buy and sell signals. Notice that it is far from debugged and that there are variables that are not used. I just want to show a base to start from.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391//--------------------------------------------------------------------------------////PRC_Smart Money Concepts//version = 1//29.07.2024//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//--------------------------------------------------------------------------------////-----Inputs---------------------------------------------------------------------//length=50n=barindexshowswings=1showHLswings=1showinternals=1showibull=1//1=all 2=bos 3=CHoCHshowibear=1//1=all 2=bos 3=CHoCHshowStructure=1showbull=1//1=all 2=bos 3=CHoCHshowbear=1//1=all 2=bos 3=CHoCHshowOB=1showiOB=1showlastOB=5ifilterConfluence=0obFilter=1 //1=ATR 0=Cumulative mean Rangemult=2bblength=20//--------------------------------------------------------------------------------////--------------------------------------------------------------------------------//atr=averagetruerange[200](close)cmeanrange=summation[max(1,n)](high-low)/n//--------------------------------------------------------------------------------////-----Bollinger Bands Calculation------------------------------------------------//averageBB=average[bblength](close)dev=mult*std[bblength](close)upperBB=averageBB+devlowerBB=averageBB-dev//--------------------------------------------------------------------------------////-----Swings---------------------------------------------------------------------////---Swing lengthos=0upper=highest[length](high)lower=lowest[length](low)if high[length]>upper thenos=0elsif low[length]<lower thenos=1elseos=os[1]endifif os=0 and os[1]<>0 thenmytop=high[length]elsemytop=0endifif os=1 and os[1]<>1 thenmybot=low[length]elsemybot=0endif//---Swing 5os1=0upper1=highest[5](high)lower1=lowest[5](low)if high[5]>upper1 thenos1=0elsif low[5]<lower1 thenos1=1elseos1=os1[1]endifif os1=0 and os1[1]<>0 thenitop=high[5]elseitop=0endifif os1=1 and os1[1]<>1 thenibot=low[5]elseibot=0endif//--------------------------------------------------------------------------------////-----Pivot High-----------------------------------------------------------------//if mytop thentopcross=1if showswings thenif mytop>topy then$phy[z+1]=mytop$phx[z+1]=n-length$phtype[z+1]=1z=z+1else$phy[z+1]=mytop$phx[z+1]=n-length$phtype[z+1]=-1z=z+1endifendiftopy=mytoptopx=n-lengthendifif itop thenitopcross=1itopy=itopitopx=n-5endif//--------------------------------------------------------------------------------////-----Pivot Low------------------------------------------------------------------//if mybot thenbotcross=1if showswings thenif mybot<boty then$ply[k+1]=mybot$plx[k+1]=n-length$pltype[k+1]=1k=k+1else$ply[k+1]=mybot$plx[k+1]=n-length$pltype[k+1]=-1k=k+1endifendifboty=mybotbotx=n-lengthendifif ibot thenibotcross=1iboty=ibotibotx=n-5endif//--------------------------------------------------------------------------------////-----Pivot High BOS/CHoCH-------------------------------------------------------//bullConcordant=1if ifilterConfluence thenbullConcordant=high-max(close,open)>min(close,open-low)endif//Detect internal bullish structureif close crosses over itopy and itopcross and topy<>itopy and bullConcordant thenchoch=undefinedif itrend<0 thenchoch=1bullichochalert=1elsebullibosalert=1endifif showinternals thenif showibull=1 or (showibull=2 and not choch) or (showibull=3 and choch) then$itopx[m+1]=itopx$itopy[m+1]=itopy$ichoch[m+1]=choch$iright[m+1]=barindexm=m+1endifendifitopcross=0itrend=1//Internal order blockif showiOB thenminim=9999999999maxim=0idx=1if obFilter=1 thenobthreshold=atrelseobthreshold=cmeanRangeendiffor i=1 to (n-itopx)-1 doif (high[i]-low[i])<obthreshold[i]*2 thenminim=min(low[i],minim)if minim=low[i] thenmaxim=high[i]idx=ielsemaxim=maximidx=idxendifendifnext$itargetTop[t+1]=maxim$itargetBot[t+1]=minim$itargetLeft[t+1]=barindex[idx]$itargetRight[t+1]=n$itargetType[t+1]=1t=t+1endifendif//Detect bullish Structureif close crosses over topy and topcross thenchoch=undefinedif trend<0 thenchoch=1endifif showStructure thenif showbull=1 or (showbull=2 and not choch) or (showbull=3 and choch) then$topx[g+1]=topx$topy[g+1]=topy$topchoch[g+1]=choch$right[g+1]=barindexg=g+1endifendif//order blockif showOB thenminim=9999999999maxim=0idx=1if obFilter=1 thenobthreshold=atrelseobthreshold=cmeanRangeendiffor i=1 to (n-topx)-1 doif (high[i]-low[i])<obthreshold[i]*2 thenminim=min(low[i],minim)if minim=low[i] thenmaxim=high[i]idx=ielsemaxim=maximidx=idxendifendifnext$targetTop[r+1]=maxim$targetBot[r+1]=minim$targetLeft[r+1]=barindex[idx]$targetRight[r+1]=n$targetType[r+1]=1r=r+1endiftopcross=0trend=1endif//--------------------------------------------------------------------------------////-----Pivot Low BOS/CHoCH--------------------------------------------------------//bearConcordant=1if ifilterConfluence thenbearConcordant=high-max(close,open)<min(close,open-low)endif//Detect internal bearish Structureif close crosses under iboty and ibotcross and boty<>iboty and bearConcordant thenchoch=0if itrend>0 thenchoch=1bearichochalert=1elsebearichochalert=1endifif showinternals thenif showibear=1 or (showibear=2 and not choch) or (showibear=3 and choch) then$ibotx[s+1]=ibotx$iboty[s+1]=iboty$ibotchoch[s+1]=choch$ibotright[s+1]=barindexs=s+1endifendifibotcross=0itrend=-1//Internal order blockif showiOB thenminim=9999999999maxim=0idx=1if obFilter=1 thenobthreshold=atrelseobthreshold=cmeanRangeendiffor i=1 to (n-ibotx)-1 doif (high[i]-low[i])<obthreshold[i]*2 thenmaxim=max(high[i],maxim)if maxim=high[i] thenminim=low[i]idx=ielseminim=minimidx=idxendifendifnext$itargetTop[t+1]=maxim$itargetBot[t+1]=minim$itargetLeft[t+1]=barindex[idx]$itargetRight[t+1]=n$itargetType[t+1]=-1t=t+1endifendif//Detect Bullish Strcutureif close crosses under boty and botcross thenchoch=undefinedif trend>0 thenchoch=1bearchochalert=1elsebearbosalert=1endifif showStructure then//if showbear=1 or (showbear=2 and not choch) or (showbear=3 and choch) then//$botx[w+1]=botx//$boty[w+1]=boty//$botchoch[w+1]=choch//$botright[w+1]=barindex//w=w+1//endifendif//order blockif showOB thenminim=9999999999maxim=0idx=1if obFilter=1 thenobthreshold=atrelseobthreshold=cmeanRangeendiffor i=1 to (n-botx)-1 doif (high[i]-low[i])<obthreshold[i]*2 thenmaxim=max(high[i],maxim)if maxim=high[i] thenminim=low[i]idx=ielseminim=minimidx=idxendifendifnext$targetTop[r+1]=maxim$targetBot[r+1]=minim$targetLeft[r+1]=barindex[idx]$targetRight[r+1]=n$targetType[r+1]=-1r=r+1endifbotcross=0trend=-1endif//-----------------------------------------------------------------------------////------Signals Internal Structure---------------------------------------------////-----------------------------------------------------------------------------//mytopsignal=$itopy[m]mybotsignal=$iboty[s]if mytopsignal<>mytopsignal[1] and $ichoch[m]=1 thenbuy 10 contract at marketset stop %loss 5set target %profit 5endif//-----------------------------------------------------------------------------//if mybotsignal<>mybotsignal[1] and $ibotchoch[s]=1 thensellshort 10 contract at marketset stop %loss 5set target %profit 5endif//-----------------------------------------------------------------------------//09/01/2024 at 3:15 PM #236972 -
AuthorPosts