Help with Fishnet code

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
bombaybom
Posts: 12
Joined: 13 Nov 2014
Has thanked: 7 times

Help with Fishnet code

Postby bombaybom » 06 Oct 2015

Hi,

I try to make this code to MC but sticks to (i=net; I<net; i ++ part) hope someone can guide me right.

Thanks in advance!

Code: Select all


/* This code plot fishnet with rainbow colors. I use 30 MA per color.*/

_SECTION_BEGIN("");
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style", styleCandle, maskPrice ) );

net= 30; // This value can be changed. It`s how many MA:s every color have.

for (i=1; i<net;i++) {
Plot(MA(Close,i),"",colorDarkRed,styleLine);
}

for (i=net; i<2*net;i++) {
Plot(MA(Close,i),"",colorOrange,styleLine);
}

for (i=2*net; i<3*net;i++) {
Plot(MA(Close,i),"",colorGold,styleLine);
}

for (i=3*net; i<4*net;i++) {
Plot(MA(Close,i),"",colorLime,styleLine);
}

for (i=4*net; i<5*net;i++) {
Plot(MA(Close,i),"",colorBlue,styleLine);
}

for (i=5*net; i<6*net;i++) {
Plot(MA(Close,i),"",colorIndigo,styleLine);
}

for (i=6*net; i<7*net;i++) {
Plot(MA(Close,i),"",colorViolet,styleLine);
}
_SECTION_END();
Attachments
rainbow (1).png
(424.81 KiB) Downloaded 1309 times

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1542 times
Been thanked: 1565 times
Contact:

Re: Help with Fishnet code

Postby JoshM » 06 Oct 2015

I try to make this code to MC but sticks to (i=net; I<net; i ++ part) hope someone can guide me right.
You can use a for-to loop for that. See for-to loop in PowerLanguage.

SP
Posts: 465
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 286 times

Re: Help with Fishnet code

Postby SP » 07 Oct 2015

Code: Select all


inputs:
Price( Close ),
BaseLength( 2 ),
Increment( 2 ),
RibsUpTo99 ( 99 );

variables:
firstpass( true ),
Ribs ( 0 ),
Length( 0 ),
Counter( 0 ) ;

arrays:
SMA[99]( 0 ),
Color[99]( 0 ) ;

if firstpass then
begin
firstpass = false ;
if RibsUpTo99 <= 99 then
begin
Ribs = AbsValue( IntPortion( RibsUpTo99 ) ) ;
If Ribs < 1 then Ribs = 1 ;
end
else Ribs = 99 ;
end ;


for Counter = 1 to Ribs
begin
Length = BaseLength + Increment * ( Counter - 1 ) ;
SMA[ Counter ] = Average( Price, Length ) ;
end ;


Plot1( SMA[1], "SMA1", DarkRed ) ;
If Ribs >= 2 then Plot2( SMA[2], "SMA2", DarkRed ) ;
if Ribs >= 3 then Plot3( SMA[3], "SMA3", DarkRed ) ;
if Ribs >= 4 then Plot4( SMA[4], "SMA4", DarkRed ) ;
if Ribs >= 5 then Plot5( SMA[5], "SMA5", DarkRed ) ;
if Ribs >= 6 then Plot6( SMA[6], "SMA6", DarkRed ) ;
if Ribs >= 7 then Plot7( SMA[7], "SMA7", DarkRed ) ;
if Ribs >= 8 then Plot8( SMA[8], "SMA8", DarkRed ) ;
if Ribs >= 9 then Plot9( SMA[9], "SMA9", DarkRed ) ;
if Ribs >= 10 then Plot10( SMA[10], "SMA10",DarkRed ) ;
if Ribs >= 11 then Plot11( SMA[11], "SMA11", DarkRed ) ;
if Ribs >= 12 then Plot12( SMA[12], "SMA12", DarkRed ) ;
if Ribs >= 13 then Plot13( SMA[13], "SMA13", DarkRed ) ;
if Ribs >= 14 then Plot14( SMA[14], "SMA14", DarkRed ) ;
if Ribs >= 15 then Plot15( SMA[15], "SMA15", 42495) ;
if Ribs >= 16 then Plot16( SMA[16], "SMA16", 42495 ) ;
if Ribs >= 17 then Plot17( SMA[17], "SMA17", 42495 ) ;
if Ribs >= 18 then Plot18( SMA[18], "SMA18", 42495 ) ;
if Ribs >= 19 then Plot19( SMA[19], "SMA19", 42495 ) ;
if Ribs >= 20 then Plot20( SMA[20], "SMA20", 42495 ) ;
if Ribs >= 21 then Plot21( SMA[21], "SMA21", 42495 ) ;
if Ribs >= 22 then Plot22( SMA[22], "SMA22", 42495) ;
if Ribs >= 23 then Plot23( SMA[23], "SMA23", 42495 ) ;
if Ribs >= 24 then Plot24( SMA[24], "SMA24", 42495) ;
if Ribs >= 25 then Plot25( SMA[25], "SMA25", 42495 ) ;
if Ribs >= 26 then Plot26( SMA[26], "SMA26", 42495 ) ;
if Ribs >= 27 then Plot27( SMA[27], "SMA27", 42495 ) ;
if Ribs >= 28 then Plot28( SMA[28], "SMA28", 42495 ) ;
if Ribs >= 29 then Plot29( SMA[29], "SMA29", yellow ) ;
if Ribs >= 30 then Plot30( SMA[30], "SMA30", yellow ) ;
if Ribs >= 31 then Plot31( SMA[31], "SMA31", yellow ) ;
if Ribs >= 32 then Plot32( SMA[32], "SMA32", yellow ) ;
if Ribs >= 33 then Plot33( SMA[33], "SMA33", yellow ) ;
if Ribs >= 34 then Plot34( SMA[34], "SMA34", yellow ) ;
if Ribs >= 35 then Plot35( SMA[35], "SMA35", yellow ) ;
if Ribs >= 36 then Plot36( SMA[36], "SMA36", yellow ) ;
if Ribs >= 37 then Plot37( SMA[37], "SMA37", yellow ) ;
if Ribs >= 38 then Plot38( SMA[38], "SMA38", yellow ) ;
if Ribs >= 39 then Plot39( SMA[39], "SMA39", yellow ) ;
if Ribs >= 40 then Plot40( SMA[40], "SMA40", yellow ) ;
if Ribs >= 41 then Plot41( SMA[41], "SMA41", yellow ) ;
if Ribs >= 42 then Plot42( SMA[42], "SMA42", yellow ) ;
if Ribs >= 43 then Plot43( SMA[43], "SMA43", 65280) ;
if Ribs >= 44 then Plot44( SMA[44], "SMA44", 65280 ) ;
if Ribs >= 45 then Plot45( SMA[45], "SMA45", 65280 ) ;
if Ribs >= 46 then Plot46( SMA[46], "SMA46", 65280 ) ;
if Ribs >= 47 then Plot47( SMA[47], "SMA47", 65280 ) ;
if Ribs >= 48 then Plot48( SMA[48], "SMA48", 65280 ) ;
if Ribs >= 49 then Plot49( SMA[49], "SMA49", 65280 ) ;
if Ribs >= 50 then Plot50( SMA[50], "SMA50", 65280) ;
if Ribs >= 51 then Plot51( SMA[51], "SMA51", 65280 ) ;
if Ribs >= 52 then Plot52( SMA[52], "SMA52", 65280 ) ;
if Ribs >= 53 then Plot53( SMA[53], "SMA53", 65280 ) ;
if Ribs >= 54 then Plot54( SMA[54], "SMA54", 65280 ) ;
if Ribs >= 55 then Plot55( SMA[55], "SMA55", 65280 ) ;
if Ribs >= 56 then Plot56( SMA[56], "SMA56", 65280 ) ;
if Ribs >= 57 then Plot57( SMA[57], "SMA57", Blue ) ;
if Ribs >= 58 then Plot58( SMA[58], "SMA58", Blue ) ;
if Ribs >= 59 then Plot59( SMA[59], "SMA59", Blue ) ;
if Ribs >= 60 then Plot60( SMA[60], "SMA60", Blue ) ;
if Ribs >= 61 then Plot61( SMA[61], "SMA61", Blue ) ;
if Ribs >= 62 then Plot62( SMA[62], "SMA62", Blue ) ;
if Ribs >= 63 then Plot63( SMA[63], "SMA63", Blue ) ;
if Ribs >= 64 then Plot64( SMA[64], "SMA64", Blue ) ;
if Ribs >= 65 then Plot65( SMA[65], "SMA65", Blue ) ;
if Ribs >= 66 then Plot66( SMA[66], "SMA66", Blue ) ;
if Ribs >= 67 then Plot67( SMA[67], "SMA67", Blue ) ;
if Ribs >= 68 then Plot68( SMA[68], "SMA68", Blue ) ;
if Ribs >= 69 then Plot69( SMA[69], "SMA69", Blue ) ;
if Ribs >= 70 then Plot70( SMA[70], "SMA70", Blue ) ;
if Ribs >= 71 then Plot71( SMA[71], "SMA71", 8519755 ) ;
if Ribs >= 72 then Plot72( SMA[72], "SMA72", 8519755 ) ;
if Ribs >= 73 then Plot73( SMA[73], "SMA73", 8519755) ;
if Ribs >= 74 then Plot74( SMA[74], "SMA74", 8519755 ) ;
if Ribs >= 75 then Plot75( SMA[75], "SMA75", 8519755 ) ;
if Ribs >= 76 then Plot76( SMA[76], "SMA76", 8519755 ) ;
if Ribs >= 77 then Plot77( SMA[77], "SMA77", 8519755 ) ;
if Ribs >= 78 then Plot78( SMA[78], "SMA78", 8519755 ) ;
if Ribs >= 79 then Plot79( SMA[79], "SMA79", 8519755 ) ;
if Ribs >= 80 then Plot80( SMA[80], "SMA80", 8519755 ) ;
if Ribs >= 81 then Plot81( SMA[81], "SMA81", 8519755 ) ;
if Ribs >= 82 then Plot82( SMA[82], "SMA82", 8519755 ) ;
if Ribs >= 83 then Plot83( SMA[83], "SMA83", 8519755 ) ;
if Ribs >= 84 then Plot84( SMA[84], "SMA84", 8519755 ) ;
if Ribs >= 85 then Plot85( SMA[85], "SMA85", 15631086 ) ;
if Ribs >= 86 then Plot86( SMA[86], "SMA86", 15631086 ) ;
if Ribs >= 87 then Plot87( SMA[87], "SMA87", 15631086 ) ;
if Ribs >= 88 then Plot88( SMA[88], "SMA88", 15631086 ) ;
if Ribs >= 89 then Plot89( SMA[89], "SMA89", 15631086 ) ;
if Ribs >= 90 then Plot90( SMA[90], "SMA90", 15631086 ) ;
if Ribs >= 91 then Plot91( SMA[91], "SMA91", 15631086 ) ;
if Ribs >= 92 then Plot92( SMA[92], "SMA92", 15631086 ) ;
if Ribs >= 93 then Plot93( SMA[93], "SMA93", 15631086 ) ;
if Ribs >= 94 then Plot94( SMA[94], "SMA94", 15631086 ) ;
if Ribs >= 95 then Plot95( SMA[95], "SMA95", 15631086 ) ;
if Ribs >= 96 then Plot96( SMA[96], "SMA96", 15631086 ) ;
if Ribs >= 97 then Plot97( SMA[97], "SMA97", 15631086 ) ;
if Ribs >= 98 then Plot98( SMA[98], "SMA98", 15631086 ) ;
if Ribs >= 99 then Plot99( SMA[99], "SMA99", 15631086 ) ;


Return to “User Contributed Studies and Indicator Library”