Stock Portfolio Organizer
The ultimate porfolio management solution.
Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
just TRADE in 10 min Time Frame and BREAK OUT for Amibroker (AFL)
Copy & Paste Friendly
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 | _SECTION_BEGIN ( "Price" ); SetChartOptions (0, chartShowArrows | chartShowDates ); SetBarsRequired ( sbrAll , sbrAll ); SetBarFillColor ( IIf ( C > O , ParamColor ( "Candle Up Color" , colorBrightGreen ), IIf ( C <= O , ParamColor ( "Candle Down Color" , colorRed ), colorLightGrey ))); Plot ( C , "Price" , IIf ( C > O , ParamColor ( "Shadow Up Color" , colorBlack ), IIf ( C <= O , ParamColor ( "Shadow Down Color" , colorBlack ), colorLightGrey )),64,0,0,0,0); SetChartBkColor ( ParamColor ( "Panel Color " , colorLightGrey )); SetChartBkGradientFill ( ParamColor ( "Upper Chart" , colorLavender ), ParamColor ( "Lower Chart" , colorTan )); GraphXSpace = Param ( "GraphXSpace" ,20,-10,25,1); _SECTION_BEGIN ( "Linear Regression Channel" ); //CyberMan's Linear Regression Channel. //Linear Regression Line with 2 Standard Deviation Channels Plotted Above and Below //The original was written by Patrick Hargus, with critical hints from Marcin Gorzynski, Amibroker Technical Support //Wysiwyg coded the angle in degrees part //I modified the original Linear Regression code so that the line will change color based on the degree of the Linear Regression slope. //I combine this with my trading system. //When my system gives an entry signal I look at the Linear Regression Line and I will only take long positions if the Linear Regression line is green and the entry price is below the LR line. //When my system gives an entry signal I look at the Linear Regression Line and I will only take short positions if the Linear Regression line is red and the entry price is above the LR line. //It is usefull for filtering out lower probability trades. _SECTION_BEGIN ( "MAMA" ); SetBarsRequired ( 10000, 10000 ); SetChartOptions (0, chartShowArrows | chartShowDates ); prc = ( High + Low ) / 2; fastlimit = 0.5; slowlimit = 0.05; pi=4* atan (1); RTD=180/pi; DTR=pi/180; Cyclepart= Param ( "Alpha" ,0.5,0.1,1,0.1); Smooth[0] = Period = Detrender[0] = I1[0] = Q1[0] = 0; phase[0]=deltaphase[0]=MAMA[0]=FAMA[0]=0; for ( i = 6; i < BarCount ; i++ ) { Smooth[i] = ( 4 * prc[i] + 3 * prc[i-1] + 2 * prc[i-2] + prc[i-3] ) / 10; AmpCorr[i] = 0.075 * Period[i-1] + 0.54; Detrender[i] = ( 0.0962 * Smooth[i] + 0.5769 * Smooth[i-2] - 0.5769 * Smooth[i-4] - 0.0962 * Smooth[i-6] ) * AmpCorr[i]; Q1[i] = ( 0.0962 * Detrender[i] + 0.5769 * Detrender[i-2] - 0.5769 * Detrender[i-4] - 0.0962 * Detrender[i-6] ) * AmpCorr[i]; I1[i] = Detrender[i-3]; if (I1[i] != 0) phase[i] = DTR*360/ atan (q1[i]/I1[i]); deltaphase[i]=phase[i-1]-phase[i]; if (deltaphase[i] <1) deltaphase[i]=1; alpha[i]=fastlimit[i]/deltaphase[i]; if (alpha[i] < slowlimit[i]) alpha[i]=slowlimit[i]; MAMA[i]=alpha[i] * prc [i] +(1-alpha[i])*MAMA[i-1]; FAMA[i]=Cyclepart*alpha[i] * prc [i] +(1-Cyclepart*alpha[i])*FAMA[i-1]; } _SECTION_END (); _SECTION_BEGIN ( "SYSTEM" ); BuySetupValue= ValueWhen ( Cross (MAMA,FAMA), H ,1); SellsetupValue= ValueWhen ( Cross (FAMA,MAMA), L ,1); Buysetup = Cross (MAMA,FAMA) ; Sellsetup = Cross (FAMA,MAMA); Longa = Flip (Buysetup,Sellsetup); shrta = Flip (Sellsetup,Buysetup); Buy =Longa AND Cross ( C ,BuySetupValue); Sell =shrta AND Cross (SellsetupValue, C ); Buy = ExRem ( Buy , Sell ); Sell = ExRem ( Sell , Buy ); t1= Flip ( Buy , Sell ); t2= Flip ( Sell , Buy ); BPrice= ValueWhen (t1 AND Ref (t1,-1)==0, C ,1); SPrice= ValueWhen (t2 AND Ref (t2,-1)==0, C ,1); GraphXSpace = 5; dist = 1.5* ATR (20); for ( i = 0; i < BarCount ; i++ ) { if ( Buy [i] ) PlotText ( "" + C [ i ], i, L [ i ]-dist[i], colorBlack ); if ( Sell [i] ) PlotText ( "" + C [ i ], i, H [ i ]+dist[i], colorBlack ); } _SECTION_END (); //=================TITLE================================================================================================ _SECTION_BEGIN ( "Title" ); if ( Status ( "action" ) == actionIndicator ) ( Title = EncodeColor ( colorWhite )+ "MAMA Poistional System" + " - " + Name () + " - " + EncodeColor ( colorRed )+ Interval (2) + EncodeColor ( colorWhite ) + " - " + Date () + " - " + "\n" + EncodeColor ( colorYellow ) + "Op-" + O + " " + "Hi-" + H + " " + "Lo-" + L + " " + "Cl-" + C + " " + "Vol= " + WriteVal ( V )+ "\n" + EncodeColor ( colorLime )+ WriteIf ( Buy , " GO LONG / Reverse Signal at " + C + " " , "" )+ WriteIf ( Sell , " EXIT LONG / Reverse Signal at " + C + " " , "" )+ "\n" + EncodeColor ( colorWhite )+ WriteIf ( Sell , "Total Profit/Loss for the Last Trade Rs." +( C -BPrice)+ "" , "" )+ WriteIf ( Buy , "Total Profit/Loss for the Last trade Rs." +(SPrice- C )+ "" , "" )+ WriteIf (Longa AND NOT Buy , "Trade : Long - Entry price Rs." +(BPrice), "" )+ WriteIf (shrta AND NOT Sell , "Trade : Short - Entry price Rs." +(SPrice), "" )+ "\n" + WriteIf (Longa AND NOT Buy , "Current Profit/Loss Rs." +( C -BPrice)+ "" , "" )+ WriteIf (shrta AND NOT Sell , "Current Profit/Loss Rs." +(SPrice- C )+ "" , "" )); PlotShapes ( IIf ( Buy , shapeSquare , shapeNone ), colorGreen , 0, L , Offset=-40); PlotShapes ( IIf ( Buy , shapeSquare , shapeNone ), colorLime , 0, L , Offset=-50); PlotShapes ( IIf ( Buy , shapeUpArrow , shapeNone ), colorWhite , 0, L , Offset=-45); PlotShapes ( IIf ( Sell , shapeSquare , shapeNone ), colorRed , 0, H , Offset=40); PlotShapes ( IIf ( Sell , shapeSquare , shapeNone ), colorOrange , 0, H , Offset=50); PlotShapes ( IIf ( Sell , shapeDownArrow , shapeNone ), colorWhite , 0, H , Offset=-45); _SECTION_END (); WriteVal ( BuyPrice ); WriteVal (Longa); WriteVal (t1); WriteVal ( SellPrice ); WriteVal (shrta); _SECTION_END (); //=========================== Back ground Text =================== _SECTION_BEGIN ( "Background text" ); GfxSetOverlayMode (1); GfxSelectFont ( "Tahoma" , Status ( "pxheight" )/23 ); GfxSetTextAlign ( 0 ); // center alignment //GfxSetTextColor( ColorRGB( 60, 45, 80 ) ); GfxSetTextColor ( ColorHSB ( 42, 42, 42 ) ); //GfxSetTextColor( ColorHSB( 5, 5,242) ); GfxSetBkMode (0); // transparent GfxTextOut ( Name (), Status ( "pxwidth" )/2, Status ( "pxheight" )/12 ); GfxSelectFont ( "Tahoma" , Status ( "pxheight" )/12 ); GfxTextOut ( "" , Status ( "pxwidth" )/2, Status ( "pxheight" )/3 ); GfxSelectFont ( "Tahoma" , Status ( "pxheight" )/20 ); GfxTextOut ( "" , Status ( "pxwidth" )/2, Status ( "pxheight" )/2 ); GfxSelectFont ( "Tahoma" , Status ( "pxheight" )/40 ); GfxTextOut ( "" , Status ( "pxwidth" )/7, Status ( "pxheight" )/6); _SECTION_END (); _SECTION_BEGIN ( "Price" ); SetChartOptions (0, chartShowArrows | chartShowDates ); SetBarsRequired ( sbrAll , sbrAll ); SetBarFillColor ( IIf ( C > O , ParamColor ( "Candle Up Color" , colorBrightGreen ), IIf ( C <= O , ParamColor ( "Candle Down Color" , colorRed ), colorLightGrey ))); Plot ( C , "Price" , IIf ( C > O , ParamColor ( "Shadow Up Color" , colorBlack ), IIf ( C <= O , ParamColor ( "Shadow Down Color" , colorBlack ), colorLightGrey )),64,0,0,0,0); SetChartBkColor ( ParamColor ( "Panel Color " , colorLightGrey )); SetChartBkGradientFill ( ParamColor ( "Upper Chart" , colorLavender ), ParamColor ( "Lower Chart" , colorTan )); GraphXSpace = Param ( "GraphXSpace" ,20,-10,25,1); TimeFrameSet ( inDaily ); DayHigh = LastValue ( H ); DayLow = LastValue ( L ); TimeFrameRestore (); Title = Date () + ", Op=" + Open + ", Hi=" + High + ", Lo=" + Low + ", LTP=" + Close + ", Change= " + SelectedValue ( ROC ( C , 1 ) ) + "%" + "\n Today`s High=" + DayHigh + ", Today`s Low=" + DayLow + " © " ; prev= AMA2 ( C ,1,0); d= IIf ( C > Ref ( Max ( Max ( H , Ref ( H ,-20)), Max ( Ref ( H ,-10), Ref ( H ,-15))),-1), Min ( Min ( L , Ref ( L ,-20)), Min ( Ref ( L ,-10), Ref ( L ,-15))), IIf ( C < Ref ( Min ( Min ( L , Ref ( L ,-20)), Min ( Ref ( L ,-10), Ref ( L ,-15))),-1), Max ( Max ( H , Ref ( H ,-20)), Max ( Ref ( H ,-10), Ref ( H ,-15))),PREV)); a= Cross ( Close ,d); b= Cross (d, Close ); state= IIf ( BarsSince (a)< BarsSince (b),1,0); s=state> Ref (state,-1); ss=state< Ref (state,-1); sss=state== Ref (state,-1); col= IIf (state == 1 ,51, IIf (state ==0,4,1)); Plot ( C , "" ,Col,64); Buy = s; Sell = ss; shape = Buy * shapeUpArrow + Sell * shapeDownArrow ; //WriteIf(s,"EXIT all Short positions\nif trading long positions, enter long Now-\nOR at the market price on tomorrow's Open with stop="+EncodeColor(4)+WriteVal(L+.75*ATR(5),1.4)+" ,",""); //WriteIf(ss,"exit all long positions today with a Market On Close (MOC) order\nOR at the market price on tomorrow's Open with stop="+EncodeColor(4)+WriteVal(Ref(H+.75*ATR(5), -1),1.4)+",",""); //WriteIf( sss ,"No trading signals today.","") ; dist = 2* ATR (10); dist1 = 5* ATR (10); for ( i = 0; i < BarCount ; i++ ) { if ( Buy [i] ) {} if ( Sell [i] ) {} } Filter = s OR sss OR sss ; AddColumn ( C , "close" ,1.2); AddColumn ( IIf ( s, 66,1 ), "buy" , formatChar, 1, bkcolor = IIf (s, colorYellow , colorPink )); AddColumn ( IIf ( Ss, 83,1 ), "sell" , formatChar, 1, bkcolor = IIf (Ss, colorPink , colorWhite )); AddColumn ( IIf ( sss, 87,1 ), "wait" , formatChar, 1, bkcolor = IIf (sss, colorYellow , colorRed )); _SECTION_BEGIN ( "BACK COLR" ); GfxSetOverlayMode (1); GfxSetOverlayMode (1); GfxSelectFont ( "Tahoma" , Status ( "pxheight" )/200 ); /* Up down name*/ GfxSetTextAlign ( 6 ); // center alignment GfxSetTextColor ( ParamColor ( "Text Color" , ColorHSB ( 42, 42, 42 ) )); GfxSetBkMode (0); // transparent GfxTextOut ( Name (), Status ( "pxwidth" )/2, Status ( "pxheight" )/7); GfxSelectFont ( "Tahoma" , Status ( "pxheight" )/300 ); GfxTextOut ( IndustryID (1), Status ( "pxwidth" )/2, Status ( "pxheight" )/5 ); /* Up Down Sector*/ GfxSelectFont ( "Tahoma" , Status ( "pxheight" )/40 ); GfxTextOut ( " " , Status ( "pxwidth" )/2, Status ( "pxheight" )/4); GfxSelectFont ( "Tahoma" , Status ( "pxheight" )/20 ); GfxTextOut ( " " , Status ( "pxwidth" )/2, Status ( "pxheight" )/15 ); _SECTION_BEGIN ( "Trade" ); SetChartBkColor ( ParamColor ( "Outer panel color " , colorLightYellow )); SetChartBkColor ( ParamColor ( "BackGround Color" , colorLavender )); pShowtradeLines = ParamToggle ( "Show Trade Lines" , "No|Yes" , 1); pShowMarkers = ParamToggle ( "Show Markers" , "No|Yes" , 1); synch= ParamToggle ( "Synchronize buy/short with foreign index" , "No|Yes" , 1); Volmin= Param ( "Volume minimum" ,5000,0,10000000,50); Volmax= Param ( "Volume maximum" ,1000000,0,10000000,50); priceRL= Param ( "Price Range Min" ,150,1,20000,1); priceRH= Param ( "Price Range Max" ,3000,1,20000,1); PercChangemin= Param ( "Percentage Change Min set" , -25, -100, 100, 0.1); PercChangemax= Param ( "Percentage Change Max set" , 25, -100, 100, 0.1); PerctakeProfit= Param ( "Take Profit Percent Set" ,0.5,0.3,30,0.1); PercStoploss= Param ( "StopLoss Percent Set" ,1,0.2,5,0.1); PlotOHLC ( Open , High , Low , Close , "" , colorWhite , styleCandle ); Bars = 0; xpdh = 90; { Plot_Range = ( TimeNum () >= 85500 AND TimeNum ()<= 153500) AND ( DateNum ()== LastValue ( DateNum ())); FH_Range = ( TimeNum () >= 085500 AND TimeNum ()<= 093000) AND ( DateNum ()== LastValue ( DateNum ())); FH_Prices = High * FH_Range; FH_Marker = BarsSince (FH_Range>0); Num_Bars = 36000 / Interval (1); TimeFrameSet ( inDaily ); TOP_ = Open ; PDH_ = Ref ( High ,-1); PDL_ = Ref ( Low ,-1); PDO_ = Ref ( Open ,-1); PDC_ = Ref ( Close ,-1); PDM_ = (PDH_+PDL_)/2; TimeFrameRestore (); isAll = True ; isRth = TimeNum () >= 085400 AND TimeNum () <= 093000; isdRth = TimeNum () >= 085400 AND TimeNum () <= 160000; aRthL = IIf (isRth, L , 1000000); aRthH = IIf (isdRth, H , Null ); aRthLd = IIf (isdRth, L , 1000000); TOP = TimeFrameExpand (TOP_, inDaily ,expandFirst); PDH = TimeFrameExpand (PDH_, inDaily ,expandFirst); PDL = TimeFrameExpand (PDL_, inDaily ,expandFirst); PDO = TimeFrameExpand (PDO_, inDaily ,expandFirst); PDC = TimeFrameExpand (PDC_, inDaily ,expandFirst); PDM = TimeFrameExpand (PDM_, inDaily ,expandFirst); FHH = Ref ( HHV ( High *FH_Range,Num_Bars),-FH_Marker); FHL = TimeFrameCompress ( aRthL, inDaily , compressLow ); FHL = TimeFrameExpand ( FHL, inDaily , expandFirst ); DayH = TimeFrameCompress ( aRthH, inDaily , compressHigh ); DayH = TimeFrameExpand ( DayH, inDaily , expandFirst ); DayL = TimeFrameCompress ( aRthLd, inDaily , compressLow ); DayL = TimeFrameExpand ( DayL, inDaily , expandFirst ); FC1=((PDH-PDL)*0.433); FC2=((PDH-PDL)*0.7666); FC3=((PDH-PDL)*1.355); FC4=(FHH-FHL); A= IIf ((FC4<=FC1+PDH*0.005),FC1,0); B= IIf ((FC4<=FC2+PDH*0.005 AND FC4>FC1+PDH*0.005),FC2,0); Cl= IIf ((FC4<=FC3 AND FC4>FC2+PDH*0.005),FC3,0); AF=(A+B+Cl); _SECTION_BEGIN ( "Trade" ); SetChartBkColor ( ParamColor ( "Outer panel color " , colorLightYellow )); SetChartBkColor ( ParamColor ( "BackGround Color" , colorBlack )); pShowtradeLines = ParamToggle ( "Show Trade Lines" , "No|Yes" , 1); pShowMarkers = ParamToggle ( "Show Markers" , "No|Yes" , 1); synch= ParamToggle ( "Synchronize buy/short with foreign index" , "No|Yes" , 1); Volmin= Param ( "Volume minimum" ,5000,0,10000000,50); Volmax= Param ( "Volume maximum" ,1000000,0,10000000,50); priceRL= Param ( "Price Range Min" ,150,1,20000,1); priceRH= Param ( "Price Range Max" ,3000,1,20000,1); PercChangemin= Param ( "Percentage Change Min set" , -25, -100, 100, 0.1); PercChangemax= Param ( "Percentage Change Max set" , 25, -100, 100, 0.1); PerctakeProfit= Param ( "Take Profit Percent Set" ,0.5,0.3,30,0.1); PercStoploss= Param ( "StopLoss Percent Set" ,1,0.2,5,0.1); PlotOHLC ( Open , High , Low , Close , "" , colorWhite , styleCandle ); Bars = 0; xpdh = 90; { Plot_Range = ( TimeNum () >= 85500 AND TimeNum ()<= 153500) AND ( DateNum ()== LastValue ( DateNum ())); FH_Range = ( TimeNum () >= 085500 AND TimeNum ()<= 093000) AND ( DateNum ()== LastValue ( DateNum ())); FH_Prices = High * FH_Range; FH_Marker = BarsSince (FH_Range>0); Num_Bars = 36000 / Interval (1); TimeFrameSet ( inDaily ); TOP_ = Open ; PDH_ = Ref ( High ,-1); PDL_ = Ref ( Low ,-1); PDO_ = Ref ( Open ,-1); PDC_ = Ref ( Close ,-1); PDM_ = (PDH_+PDL_)/2; TimeFrameRestore (); isAll = True ; isRth = TimeNum () >= 085400 AND TimeNum () <= 093000; isdRth = TimeNum () >= 085400 AND TimeNum () <= 160000; aRthL = IIf (isRth, L , 1000000); aRthH = IIf (isdRth, H , Null ); aRthLd = IIf (isdRth, L , 1000000); TOP = TimeFrameExpand (TOP_, inDaily ,expandFirst); PDH = TimeFrameExpand (PDH_, inDaily ,expandFirst); PDL = TimeFrameExpand (PDL_, inDaily ,expandFirst); PDO = TimeFrameExpand (PDO_, inDaily ,expandFirst); PDC = TimeFrameExpand (PDC_, inDaily ,expandFirst); PDM = TimeFrameExpand (PDM_, inDaily ,expandFirst); FHH = Ref ( HHV ( High *FH_Range,Num_Bars),-FH_Marker); FHL = TimeFrameCompress ( aRthL, inDaily , compressLow ); FHL = TimeFrameExpand ( FHL, inDaily , expandFirst ); DayH = TimeFrameCompress ( aRthH, inDaily , compressHigh ); DayH = TimeFrameExpand ( DayH, inDaily , expandFirst ); DayL = TimeFrameCompress ( aRthLd, inDaily , compressLow ); DayL = TimeFrameExpand ( DayL, inDaily , expandFirst ); FC1=((PDH-PDL)*0.433); FC2=((PDH-PDL)*0.7666); FC3=((PDH-PDL)*1.355); FC4=(FHH-FHL); A= IIf ((FC4<=FC1+PDH*0.005),FC1,0); B= IIf ((FC4<=FC2+PDH*0.005 AND FC4>FC1+PDH*0.005),FC2,0); Cl= IIf ((FC4<=FC3 AND FC4>FC2+PDH*0.005),FC3,0); AF=(A+B+Cl); //foreign _SECTION_BEGIN ( "foreign Index bar graph" ); Vr= ParamList ( "Index" ,List = "^NSEI,^NSEBANK,^CNXIT,^NSMIDCP,RELIANCE.NS,SB IN.N S" ,0); SetForeign (Vr); HaC =( O + H + L + C )/4; HaO = AMA ( Ref ( HaC, -1 ), 0.5 ); HaH = Max ( H , Max ( HaC, HaO) ); HaL = Min ( L , Min ( HaC, HaO) ); BG3= HHV ( LLV (HaL,4)+ ATR (4),8); BR3= LLV ( HHV (HaH ,4)- ATR (4),8); co = IIf (Hac>BG3 , colorTan , IIf (Hac < BR3, colorTan , colorTan )); Plot (4, "" , Co, styleArea + styleOwnScale | styleNoLabel , -1, 100); RestorePriceArrays (); _SECTION_END (); BuyPrice =(DayL+AF); BuyTP1=( BuyPrice +( BuyPrice *(PerctakeProfit/100))); BuyTP2=( C >=BuyTP1); SellPrice =(DayH-AF); SellTP1=( SellPrice -( SellPrice *(PerctakeProfit/100))); SellTP2=( C <=SellTP1); percchange=((( C -TOP)/TOP)*100); Vol=( V >=Volmin AND V <=Volmax); Percentage=(percchange>=PercChangemin AND percchange<=PercChangemax); prc=( C >=priceRL AND C <=priceRH); BuyStop1=( BuyPrice -( BuyPrice *(PercStoploss/100))); BuyStop2= IIf ((BuyStop1<= SellPrice ) AND SellPrice <= BuyPrice , SellPrice ,BuyStop1); SellStop1=( SellPrice +( SellPrice *(PercStoploss/100))); SellStop2= IIf ((SellStop1>= BuyPrice ) AND SellPrice <= BuyPrice , BuyPrice ,SellStop1); BuyStop= IIf (( Buy AND NOT BuyTP2),BuyStop2, Null ); BuyTP= IIf ( Buy AND NOT BuyStop,BuyTP2, Null ); Bars = BarsSince ( TimeNum () >= 85400 AND TimeNum () < 092900); x0 = BarCount - LastValue (Bars); x1 = BarCount -1; TOP_Line = LineArray (x0, LastValue (TOP),x1, LastValue (TOP),0); PDH_Line = LineArray (x0, LastValue (PDH),x1, LastValue (PDH),0); PDL_Line = LineArray (x0, LastValue (PDL),x1, LastValue (PDL),0); PDC_Line = LineArray (x0, LastValue (PDC),x1, LastValue (PDC),0); PDM_Line = LineArray (x0, LastValue (PDM),x1, LastValue (PDM),0); FHH_Line = LineArray (x0, LastValue (FHH),x1, LastValue (FHH),0); FHL_Line = LineArray (x0, LastValue (FHL),x1, LastValue (FHL),0); BuyPriceline= LineArray (x0, LastValue ( BuyPrice ),x1, LastValue ( BuyPrice ),2); BuyStopline= LineArray (x0, LastValue (BuyStop2),x1, LastValue (BuyStop2),0); BuyTPline= LineArray (x0, LastValue (BuyTP1),x1, LastValue (BuyTP1),0); SellPriceline= LineArray (x0, LastValue ( SellPrice ),x1 , LastValue ( SellPrice ),2); SellStopline= LineArray (x0, LastValue (SellStop2),x1, LastValue (SellStop2),0); SellTPline= LineArray (x0, LastValue (SellTP1),x1, LastValue (SellTP1),0); DayHline= LineArray (x0, LastValue (DayH),x1, LastValue (DayH),0); DayLline= LineArray (x0, LastValue (DayL),x1, LastValue (DayL),0); style = styleLine | styleNoRescale | styleLine ; Plot (BuyPriceline, "BuyPriceline" , colorOrange , styleDashed | styleNoRescale | styleThick ); Plot (SellPriceline, "SellPriceline" , colorOrange , styleDashed | styleNoRescale | styleThick ); PlotShapes ( IIf (pShowMarkers AND Buy , shapeHollowUpArrow , Null ), colorDarkGreen , 0, L ,Offset=-30); if ( Status ( "action" ) == actionIndicator ) ( Title = EncodeColor ( colorBlack )+ "Trading System" + " - " + Name () + " - " + EncodeColor ( colorBlack )+ Interval (2) + EncodeColor ( colorBlack ) + " - " + Date () + " - " + EncodeColor ( colorBlack ) + "-Open=" + WriteVal ( O ,1) + EncodeColor ( colorBlack ) + "- High= " + WriteVal ( H ,1)+ EncodeColor ( colorBlack ) + "- Close= " + WriteVal ( C ,1)+ EncodeColor ( colorBlack ) + "- Vol= " + WriteVal ( V ,1)+ WriteIf (Percchange, " % Change = " +(Percchange)+ " " , "" )+( "\n" )+ " Previous DayHigh=" + WriteVal (PDH,1)+ ", Previous DayLow=" + WriteVal (PDL,1)+ ", Today High=" + WriteVal (DayH,1)+ ", Todays Low=" + WriteVal (DayL,1)+ Comm2=( "\n " +Vr+ " Phase: " )+ WriteIf (Hac>BG3, EncodeColor ( colorBrightGreen )+ "+Up " , WriteIf (Hac<BR3, EncodeColor ( colorRed )+ "-Down" , EncodeColor ( colorLightYellow )+ "< Flat >" ))); GfxSetOverlayMode ( mode = 0 ); GfxSelectPen ( colorLightBlue , 3 ); GfxSelectSolidBrush ( colorLightYellow ); GfxRoundRect ( 20, 55, 180, 175, 15, 15 ); GfxSetBkMode (1); GfxSelectFont ( "Arial" , 10, 700, False ); GfxSetTextColor ( colorBrown ); GfxSetTextAlign (0); GfxTextOut ( WriteIf ( BuyPrice , "Buy Above: " +( BuyPrice ), "" ), 30, 75); GfxTextOut ( WriteIf ( SellPrice , "Sell Below: " +( SellPrice ), "" ), 30, 120); GfxTextOut ( WriteIf (Buystop2, "TRP level: " +(Buystop2), "" ), 30, 60); AddColumn ( V , "Volume" ,1.0); AddColumn (Percchange, "Change %" ,1.2); AddColumn ( BuyPrice , "Buy at" ,1.2); AddColumn (BuyStop, "Buy Stop at" ,1.2); AddColumn (BuyTP1, "Buy Profit at" ,1.2); AddColumn ( SellPrice , "Short at" ,1.2); AddColumn (SellTP1, "Short profit at" ,1.2); } _SECTION_END (); //ADDED PIVOTS LINES LATER } _SECTION_END (); //SetChartBkGradientFill( ParamColor("BgTop", ColorRGB( 172,172,172 )), //ParamColor("BgBottom", ColorRGB( 172,172,172 )),ParamColor("titleblock",ColorRGB( 172,172,172 ))); GraphXSpace = 16; SetChartBkColor ( colorTan ); SetChartOptions (0, chartShowArrows | chartShowDates ); A = DEMA ( H ,180); B = EMA ( H ,100); G = DEMA ( L ,180); I = EMA ( L ,100); D = Min (G,I); E = Max (A,B); /* Buy or Sell Condition */ Buy = Cover = Cross ( Close ,E); Sell = Short = Cross (D, Close ); Buy = ExRem ( Buy , Sell ); Sell = ExRem ( Sell , Buy ); SellPrice = ValueWhen ( Sell , C ,1); BuyPrice = ValueWhen ( Buy , C ,1); Filter = Buy OR Sell ; /* Exploration Parameters */ AddTextColumn ( FullName (), "Company Name" ); AddColumn ( Buy , "Buy" , 1 ); AddColumn ( Sell , "Sell" , 1 ); AddColumn ( C , "Close" , 1.3 ); AddColumn ( H , "High" , 1.3 ); Title = EncodeColor ( colorWhite )+ " © (Equity) Market Trading System" + " - " + Name () + " - " + EncodeColor ( colorRed )+ Interval (2) + EncodeColor ( colorWhite ) + " - " + Date () + " - " + "\n" + EncodeColor ( colorRed ) + "Op-" + O + " " + "Hi-" + H + " " + "Lo-" + L + " " + "Cl-" + C + " " + "Vol= " + WriteVal ( V )+ "\n" + EncodeColor ( colorLime )+ WriteIf ( Buy , " GO LONG / Reverse Signal at " + C + " " , "" )+ WriteIf ( Sell , " EXIT LONG / Reverse Signal at " + C + " " , "" )+ "\n" + EncodeColor ( colorWhite ); _SECTION_END (); Buy = ExRem ( Buy , Sell ); Sell = ExRem ( Sell , Buy ); //SetChartBkColor(colorBlack); //GraphXSpace = 10; _SECTION_BEGIN ( "imp 2500 plane for overlay only" ); prev= AMA2 ( C ,1,0); d= IIf ( C > Ref ( Max ( Max ( H , Ref ( H ,-20)), Max ( Ref ( H ,-10), Ref ( H ,-15))),-1), Min ( Min ( L , Ref ( L ,-20)), Min ( Ref ( L ,-10), Ref ( L ,-15))), IIf ( C < Ref ( Min ( Min ( L , Ref ( L ,-20)), Min ( Ref ( L ,-10), Ref ( L ,-15))),-1), Max ( Max ( H , Ref ( H ,-20)), Max ( Ref ( H ,-10), Ref ( H ,-15))),PREV)); a= Cross ( Close ,d); b= Cross (d, Close ); state= IIf ( BarsSince (a)< BarsSince (b),1,0); s=state> Ref (state,-1); ss=state< Ref (state,-1); sss=state== Ref (state,-1); col= IIf (state == 1 ,5, IIf (state ==0,4,1)); Plot ( C , "" ,Col,64); //d = Close > Ref( ChandelierHL(ATR(3),20), -1); //e =Close < Ref( ChandelierHL(ATR(3),20), -1); //f = Close < Ref( ChandelierHL(ATR(3),20), -1); //g = Close > Ref( ChandelierHL(ATR(3),20), -1); DayH = SelectedValue ( TimeFrameGetPrice ( "H" , inDaily )); // yesterdays high DayL = SelectedValue ( TimeFrameGetPrice ( "L" , inDaily )); //low DayH1 = SelectedValue ( TimeFrameGetPrice ( "H" , inDaily , -1)); // yesterdays high DayL1 = SelectedValue ( TimeFrameGetPrice ( "L" , inDaily , -1)); //low DayH2 = SelectedValue ( TimeFrameGetPrice ( "H" , inDaily , -2)); // yesterdays high DayL2 = SelectedValue ( TimeFrameGetPrice ( "L" , inDaily , -2)); //low DayH3 = SelectedValue ( TimeFrameGetPrice ( "H" , inDaily , -3)); // yesterdays high DayL3 = SelectedValue ( TimeFrameGetPrice ( "L" , inDaily , -3)); //low DayH4 = SelectedValue ( TimeFrameGetPrice ( "H" , inDaily , -4)); // yesterdays high DayL4 = SelectedValue ( TimeFrameGetPrice ( "L" , inDaily , -4)); //low Range = ((DayH+DayH1+DayH2+DayH3+DayH4)/5 - (DayL+DayL1+DayL2+DayL3+DayL4)/5); sr3= (Range *0.702)+DayL; sr4= DayH-(Range *0.655); style = styleLine | styleNoRescale | styleLine ; Plot (sr3, "SR3" , colorBlue , styleDashed | styleNoRescale | styleThick ); Plot (sr4, "SR4" , colorGreen , styleDashed | styleNoRescale | styleThick ); Bars_so_far_today = 1 + BarsSince ( Day () != Ref ( Day (), -1)); TT= RSIa ( C ,60); StartBar = ValueWhen ( TimeNum () == 090000, BarIndex ()); TodayVolume = Sum (TT,Bars_so_far_today); IIf ( BarIndex () >= StartBar, VWAP = Sum ( C * TT, Bars_so_far_today ) / TodayVolume,0); GraphXSpace = 16; A = DEMA ( H ,180); B = EMA ( H ,100); G = DEMA ( L ,180); I = EMA ( L ,100); D = Min (G,I); E = Max (A,B); /* Buy or Sell Condition */ Buy = Cover = Cross ( Close ,E); Sell = Short = Cross (D, Close ); Buy = ExRem ( Buy , Sell ); Sell = ExRem ( Sell , Buy ); SellPrice = ValueWhen ( Sell , C ,1); BuyPrice = ValueWhen ( Buy , C ,1); Filter = Buy OR Sell ; /* Exploration Parameters */ AddTextColumn ( FullName (), "Company Name" ); AddColumn ( Buy , "Buy" , 1 ); AddColumn ( Sell , "Sell" , 1 ); AddColumn ( C , "Close" , 1.3 ); AddColumn ( H , "High" , 1.3 ); Title = EncodeColor ( colorWhite )+ " " + " - " + Name () + " - " + EncodeColor ( colorRed )+ Interval (2) + EncodeColor ( colorWhite ) + " - " + Date () + " - " + "\n" + EncodeColor ( colorRed ) + "Op-" + O + " " + "Hi-" + H + " " + "Lo-" + L + " " + "Cl-" + C + " " + "Vol= " + WriteVal ( V )+ "\n" + EncodeColor ( colorLime )+ WriteIf ( Buy , " GO LONG / Reverse Signal at " + C + " " , "" )+ WriteIf ( Sell , " EXIT LONG / Reverse Signal at " + C + " " , "" )+ "\n" + EncodeColor ( colorPink ); _SECTION_END (); Buy = ExRem ( Buy , Sell ); Sell = ExRem ( Sell , Buy ); //GraphXSpace = 10; _SECTION_END (); |