Stock Portfolio Organizer
The ultimate porfolio management solution.
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
AutoTrade Control For NEST/NOW for Amibroker (AFL)
AutoTrade Control For NEST/NOW
This is the updation of Manual Trade Control for NEST/NOW. This afl have new features like it will have all the trades in its memory.
This AFL is not a strategy for trading. It is only integrating the Amibroker to NEST/NOW through NEST PLUS API.
You have to replace the existing buy/sell strategy with your buy/sell strategy.
Strictly do not use the buy/sell strategy in this afl for real trading.
Features
1. You can predefine your quantity of Buy/Sell in the parameters
2. You Can Enter your Client ID in the Parameters
3. You can select the Buy/Sell Price from Ask price, Bid price or LTP.
4. Option for Enabling Actual Trading (If Disabled, No Signals will go to NOW/NEST, But chart will generate signals.) This can be used for testing.
5. Selecting the Buy/Sell as Intraday or Delivery.
6. Selecting Order Type as Limit/ market
7. Short/Cover is included. You can add strategy and manual trade also is possible.
8. It saves all Buy/Sell & Short/Cover trades in memory and plotted until its cleared.
9. Option for selecting type of trade. ie Long,Short or Together. Long trade will only starts with a buy signal and Short Trade will Only start with Short Signal. Sell and Cover signals will only appear after buy and short signals.
10. Separate display for Buy, Sell, Short and Cover Traders for clarity.
11. KeyBoard Shortcut for Buttons.
Buy → Numpad 7
Sell → Numpad 8
Short → Numpad 4
Cover → Numpad 5
Clear → Numpad 0
Requiremets
1. For Buy/Sell Price selection, use Aux1 and Aux2 for importing the Ask Bid Prices.
2. Symbol in the Amibroker should be the same as present in the NEST/NOW.
3. Active Nest Plus API Subscription is required (Contact your broker for NEST PLUS API subscription)
4. NEST/NOW trader should be opened and logged in. Also logged in to the NEST PLUS with a valid API subscription.
Usage
1. Copy The Afl to Custom Afl folder of amibroker.
2. OPEN AFL IN FORMULA EDITED AND DELETE STRATEGY PORTION OF CODE AND TYPE PASTE YOUR BUY/SELL STRATEGY IN THAT PLACE AND SAVE THE AFL.
2. Drag and drop the afl to an intraday chart blank chart.
3. Enable Controls and Strategy and Autotrade options.
4. Select type of trades you want (Long/Short)
5. Select Buy Price, Sell Price, Product Type and Order Type
6. Enter Client ID and LotQty.
Press Buy/Sell/Short/Cover buttons for manual trading.
Strategy based signals will come automatically.
Note: Only Buy and Short will happen first. You cannot do a Sell or Cover in first. Only Two BUY or SELL or SHORT or COVER one after another are not possible.
Note: Don’t use this afl for backtesting your strategy. BackTest your strategy separately and paste it in this afl.
[Suggest Features For Improvement. This Afl is tested with amibroker 5.7 and 5.9 veraions]
[NEST, NOW, Amibroker are registered products of the Respective Companies]
Screenshots
Indicator / Formula
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 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 | Title = " " ; _SECTION_BEGIN ( "RKR_AutoTrade1V00 " ); EnableRealTimeControl = ParamList ( "Enable Controls" , "No|Yes" , 0); EnableStrategy = ParamList ( "Enable Strategy" , "No|Yes" , 0); StrategyType = ParamList ( "StrategyType" , "Long/Short|Long|Short" , 0); EnableAutoTrade = ParamList ( "Enable Autotrade" , "No|Yes" , 0); BuyPriceSelection = ParamList ( "Buy Price" , "Bid Price|Ask Price|LTP" , 0); SellPriceSelection = ParamList ( "Sell Price" , "Ask Price|Bid Price|LTP" , 0); ProductType = ParamList ( "Product Type" , "MIS|NRML" , 0); OrderType = ParamList ( "Order Type" , "LIMIT|MARKET" , 0); ClientIdValue = ParamStr ( "Client Id" , "CLIENTID" ); LotQuantity = Param ( "Lot Quantity" , 1000, 50, 100000, 10); // Default Trade Qty. X2 = Param ( "Button X Offset" , 0, 0, 2000, 100); Y2 = Param ( "Button Y Offset" , 0, 0, 2000, 100); X1 = Param ( "Button Size" , 100, 100, 300, 50); ParamList ( "Written By" , "Ranjith K R" ); ParamList ( "e-mail ID" , "ranjicgnr@gmail.com" ); Buy = 0; Sell = 0; Short = 0; Cover = 0; if (EnableStrategy == "Yes" ) { /*~~~~~~~~~~~~~~~~AutoTrade Strategy~~~~~~~~~~~~~~~~~~~~~~*/ /* You Have to replace the below code with your strategy Strictly don't use the bellow Buy/Sell code for real Trading */ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ Buy = Cross ( MACD (12, 26), Signal (12, 26, 9)); Sell = Cross ( Signal (12, 26, 9), MACD (12, 26)); Short = Cross ( Signal (12, 26, 9), MACD (12, 26)); Cover = Cross ( MACD (12, 26), Signal (12, 26, 9)); /*~~~~~~~~~~~~~~~End Of AutoTrade Strategy~~~~~~~~~~~~~~~~*/ } if (EnableAutoTrade == "Yes" && EnableRealTimeControl == "Yes" ) { if ( StaticVarGetText ( "firstflagforNest" )== "" ) { nestplus = Null ; if ( IsNull (nestplus)) { nestplus = CreateStaticObject ( "Nest.PlusApi" ); nestplus.SetObjectName( "RKRAutoTrade" ); } StaticVarSetText ( "firstflagforNest" , "0" , 1); } } X0 = 20; Y0 = 10; procedure DashBoard (Text, x1, y1, x2, y2, colorFrom, colorTo) { GfxSetOverlayMode (0); GfxSelectFont ( "Segoe UI" , 8.5, 500); GfxSetBkMode (1); GfxGradientRect (x1, y1, x2, y2, colorFrom, colorTo); GfxDrawText (Text, x1, y1, x2, y2, 32|0|4|16); } GfxSetTextColor ( colorWhite ); DashBoard ( " Strategy: " + EnableStrategy, X0, Y0, X0+150, Y0+13, colorGrey40 , colorGrey40 ); DashBoard ( " Strategy Type: " + StrategyType, X0, Y0+13, X0+150, Y0+26, colorGrey40 , colorGrey40 ); DashBoard ( " Auto Trade: " + EnableAutoTrade, X0, Y0+26, X0+150, Y0+38, colorGrey40 , colorGrey40 ); DashBoard ( " Buy Price: " + BuyPriceSelection, X0, Y0+38, X0+150, Y0+50, colorGrey40 , colorGrey40 ); DashBoard ( " Sell Price: " + SellPriceSelection, X0, Y0+50, X0+150, Y0+62, colorGrey40 , colorGrey40 ); DashBoard ( " Product Type: " + ProductType, X0, Y0+62, X0+150, Y0+75, colorGrey40 , colorGrey40 ); DashBoard ( " Order Type: " + OrderType, X0, Y0+75, X0+150, Y0+88, colorGrey40 , colorGrey40 ); DashBoard ( "" , X0+1, Y0+88, X0+149, Y0+89, colorRed , colorRed ); GfxSetTextColor ( colorAqua ); DashBoard ( " Written By: Ranjith K R" , X0, Y0+89, X0+150, Y0+105, colorBlack , colorBlack ); X0 = 180; Y0 = 10; procedure DrawData (Text, x1, y1, x2, y2, colorFrom, colorTo) { GfxSetOverlayMode (0); GfxSelectFont ( "Segoe UI" , 8.5, 600); GfxSetBkMode (1); GfxGradientRect (x1, y1, x2, y2, colorFrom, colorTo); GfxDrawText (Text, x1, y1, x2, y2, 32|0|4|16); } GfxSetTextColor ( colorWhite ); DrawData ( " " + Name (), X0, Y0, X0+200, Y0+15, colorGrey40 , colorGrey40 ); DrawData ( " " + Date (), X0+205, Y0, X0+360, Y0+15, colorGrey40 , colorGrey40 ); DrawData ( " Open : " + Open , X0+365, Y0, X0+505, Y0+15, colorGrey40 , colorGrey40 ); DrawData ( " Close : " + Close , X0+510, Y0, X0+650, Y0+15, colorGrey40 , colorGrey40 ); DrawData ( " High : " + High , X0+655, Y0, X0+795, Y0+15, colorGrey40 , colorGrey40 ); DrawData ( " Low : " + Low , X0+800, Y0, X0+940, Y0+15, colorGrey40 , colorGrey40 ); DrawData ( " Volume : " + NumToStr ( Volume ,1,0), X0+945, Y0, X0+1100, Y0+15, colorGrey40 , colorGrey40 ); DrawData ( " % Change : " + NumToStr ( ((( C - O )*100)/ O ), 1.2, True ), X0+1105, Y0, X0+1235, Y0+15, colorGrey40 , colorGrey40 ); if ( StaticVarGetText ( "firstflag" )== "" ) { StaticVarSet ( "OrderNo" , 0); StaticVarSetText ( "firstflag" , "0" ); } if ( StaticVarGetText ( "firstflag" + Name ())== "" ) { StaticVarSet (( "BuyIndex" + Name ()), 0); StaticVarSet (( "BuyCount" + Name ()), 0); StaticVarSet (( "BuyFlag" + Name ()), 0); StaticVarSet (( "BuyPrice" + Name ()), 0); StaticVarSet (( "BuyQty" + Name ()), 0); StaticVarSet (( "SellIndex" + Name ()), 0); StaticVarSet (( "SellCount" + Name ()), 0); StaticVarSet (( "SellFlag" + Name ()), 0); StaticVarSet (( "SellPrice" + Name ()), 0); StaticVarSet (( "SellQty" + Name ()), 0); StaticVarSet (( "ShortIndex" + Name ()), 0); StaticVarSet (( "ShortCount" + Name ()), 0); StaticVarSet (( "ShortFlag" + Name ()), 0); StaticVarSet (( "ShortPrice" + Name ()), 0); StaticVarSet (( "ShortQty" + Name ()), 0); StaticVarSet (( "CoverIndex" + Name ()), 0); StaticVarSet (( "CoverCount" + Name ()), 0); StaticVarSet (( "CoverFlag" + Name ()), 0); StaticVarSet (( "CoverPrice" + Name ()), 0); StaticVarSet (( "CoverQty" + Name ()), 0); StaticVarSet ( "LTPSave" + Name (), 0); StaticVarSet ( "LTQSave" + Name (), 0); StaticVarSet ( "VolumeTemp" + Name (), 0); StaticVarSet ( "AskSave" + Name (), 0); StaticVarSet ( "BidSave" + Name (), 0); StaticVarSet ( "LastLTPColor" + Name (), colorGrey40 ); StaticVarSet ( "LastLTQColor" + Name (), colorGrey40 ); StaticVarSet ( "LastAskColor" + Name (), colorGrey40 ); StaticVarSet ( "LastBidColor" + Name (), colorGrey40 ); StaticVarSetText ( "firstflag" + Name (), "0" ); } CurrentAskPrice = LastValue (Aux1); CurrentBidPrice = LastValue (Aux2); CurrentTradedPrice = LastValue ( C ); CurrentVolume = LastValue ( Volume ); if (BuyPriceSelection == "Bid Price" ) { BuyPriceValue = CurrentBidPrice; } else if (BuyPriceSelection == "Ask Price" ) { BuyPriceValue = CurrentAskPrice; } else { BuyPriceValue = CurrentTradedPrice; } if (SellPriceSelection == "Ask Price" ) { SellPriceValue = CurrentAskPrice; } else if (SellPriceSelection == "Bid Price" ) { SellPriceValue = CurrentBidPrice; } else { SellPriceValue = CurrentTradedPrice; } LTPTemp = StaticVarGet ( "LTPSave" + Name ()); LTQTemp = StaticVarGet ( "LTQSave" + Name ()); VolumeTemp = StaticVarGet ( "VolumeTemp" + Name ()); AskTemp = StaticVarGet ( "AskSave" + Name ()); BidTemp = StaticVarGet ( "BidSave" + Name ()); CurrentLTQ = (CurrentVolume - VolumeTemp); if (CurrentLTQ < 0) { CurrentLTQ = CurrentLTQ * -1; } if (CurrentLTQ == 0) { CurrentLTQ = LTQTemp; } LTPColor = StaticVarGet ( "LastLTPColor" + Name ()); LTQColor = StaticVarGet ( "LastLTQColor" + Name ()); AskColor = StaticVarGet ( "LastAskColor" + Name ()); BidColor = StaticVarGet ( "LastBidColor" + Name ()); if (LTPTemp > CurrentTradedPrice) { LTPColor = colorRed ; } else if (LTPTemp < CurrentTradedPrice) { LTPColor = ColorGreen ; } if (LTQTemp > CurrentLTQ) { LTQColor = colorRed ; } else if (LTQTemp < CurrentLTQ) { LTQColor = ColorGreen ; } if (AskTemp > CurrentAskPrice) { AskColor = colorRed ; } else if (AskTemp < CurrentAskPrice) { AskColor = ColorGreen ; } if (BidTemp > CurrentBidPrice) { BidColor = colorRed ; } else if (BidTemp < CurrentBidPrice) { BidColor = ColorGreen ; } StaticVarSet ( "LastLTPColor" + Name (), LTPColor); StaticVarSet ( "LastLTQColor" + Name (), LTQColor); StaticVarSet ( "LastAskColor" + Name (), AskColor); StaticVarSet ( "LastBidColor" + Name (), BidColor); StaticVarSet ( "LTPSave" + Name (), CurrentTradedPrice); StaticVarSet ( "LTQSave" + Name (), CurrentLTQ); StaticVarSet ( "VolumeTemp" + Name (), CurrentVolume); StaticVarSet ( "AskSave" + Name (), CurrentAskPrice); StaticVarSet ( "BidSave" + Name (), CurrentBidPrice); X0 = X2 + 20; Y0 = Y2 + 120; LBClick = GetCursorMouseButtons () == 9; // Click MouseX = Nz ( GetCursorXPosition (1)); // MouseY = Nz ( GetCursorYPosition (1)); // NumPad0 = GetAsyncKeyState(96) < 0; NumPad4 = GetAsyncKeyState(100) < 0; NumPad5 = GetAsyncKeyState(101) < 0; NumPad7 = GetAsyncKeyState(103) < 0; NumPad8 = GetAsyncKeyState(104) < 0; procedure DrawBut (Text, x1, y1, x2, y2, colorFrom, colorTo) { GfxSetOverlayMode (0); GfxSelectFont ( "Segoe UI" , 9, 700); GfxSetBkMode (1); GfxGradientRect (x1, y1, x2, y2, colorFrom, colorTo); GfxDrawText (Text, x1, y1, x2, y2, 32|1|4|16); } GfxSetTextColor ( colorWhite ); if (EnableRealTimeControl == "Yes" ) { DrawBut ( "Buy" , X0, Y0, X0+X1, Y0+30, colorGreen , colorGreen ); CursorInBuyButton = MouseX >= X0 AND MouseX <= X0+X1 AND MouseY >= Y0 AND MouseY <= Y0+30; BuyButtonClick = CursorInBuyButton AND LBClick; if (BuyButtonClick || NumPad7 ) { TempBuy = Buy ; Buy = IIf (( DateTime () == LastValue ( DateTime ())) || (TempBuy == True ), True , False ); } DrawBut ( "Sell" , X0, Y0+40, X0+X1, Y0+70, colorRed , colorRed ); CursorInSellButton = MouseX >= X0 AND MouseX <= X0+X1 AND MouseY >= Y0+40 AND MouseY <= Y0+70; SellButtonClick = CursorInSellButton AND LBClick; if (SellButtonClick || NumPad8) { TempSell = Sell ; Sell = IIf (( DateTime () == LastValue ( DateTime ())) || (TempSell == True ), True , False ); } DrawBut ( "Short" , X0, Y0+80, X0+X1, Y0+110, colorOrange , colorOrange ); CursorInShortButton = MouseX >= X0 AND MouseX <= X0+X1 AND MouseY >= Y0+80 AND MouseY <= Y0+110; ShortButtonClick = CursorInShortButton AND LBClick; if (ShortButtonClick || NumPad4) { TemShort = Short ; Short = IIf (( DateTime () == LastValue ( DateTime ())) || (TemShort == True ), True , False ); } DrawBut ( "Cover" , X0, Y0+120, X0+X1, Y0+150, colorTurquoise , colorTurquoise ); CursorInCoverButton = MouseX >= X0 AND MouseX <= X0+X1 AND MouseY >= Y0+120 AND MouseY <= Y0+150; CoverButtonClick = CursorInCoverButton AND LBClick; if (CoverButtonClick || NumPad5) { TempCover = Cover ; Cover = IIf (( DateTime () == LastValue ( DateTime ())) || (TempCover == True ), True , False ); } DrawBut ( "Clear Data" , X0, Y0+160, X0+X1, Y0+190, colorGrey40 , colorGrey40 ); CursorInClearButton = MouseX >= X0 AND MouseX <= X0+X1 AND MouseY >= Y0+160 AND MouseY <= Y0+190; ClearButtonClick = CursorInClearButton AND LBClick; if (ClearButtonClick || NumPad0 ) { DrawBut( "Clear" , X0+X1+10, Y0, X0+X1+75, Y0+30, colorGrey40 , colorGrey40 ); StaticVarSetText ( "firstflag" + Name (), "" ); } //TempBuy = Buy; TempBuy = IIf (( DateTime () == LastValue ( DateTime ())) && ( LastValue ( Buy ) == True ), True , False ); BuyTempData = StaticVarGet ( "BuyIndex" + Name ()); TempCount = StaticVarGet ( "BuyCount" + Name ()); BuyPrevTemp = 0; for (i = 0; i <= TempCount; i++) { BuyPrevTemp = BuyPrevTemp | ( IIF ( DateTime () == BuyTempData[i], True , False )); } Buy = IIF (((BuyPrevTemp == True ) || (TempBuy == True )), True , False ); //TempSell = Sell; TempSell = IIf (( DateTime () == LastValue ( DateTime ())) && ( LastValue ( Sell ) == True ), True , False ); SellTempData = StaticVarGet ( "SellIndex" + Name ()); TempCount = StaticVarGet ( "SellCount" + Name ()); SellPrevTemp = 0; for (i = 0; i <= TempCount; i++) { SellPrevTemp = SellPrevTemp | ( IIF ( DateTime () == SellTempData[i], True , False )); } TempCount = StaticVarGet ( "BuyCount" + Name ()); Sell = IIF ((TempCount > 0) && ((SellPrevTemp == True ) || (TempSell == True )), True , False ); //TempShort = Short; TempShort = IIf (( DateTime () == LastValue ( DateTime ())) && ( LastValue ( Short ) == True ), True , False ); ShortTempData = StaticVarGet ( "ShortIndex" + Name ()); TempCount = StaticVarGet ( "ShortCount" + Name ()); ShortPrevTemp = 0; for (i = 0; i <= TempCount; i++) { ShortPrevTemp = ShortPrevTemp | ( IIF ( DateTime () == ShortTempData[i], True , False )); } Short = IIF (((ShortPrevTemp == True ) || (TempShort == True )), True , False ); //TempCover = Cover; TempCover = IIf (( DateTime () == LastValue ( DateTime ())) && ( LastValue ( Cover ) == True ), True , False ); CoverTempData = StaticVarGet ( "CoverIndex" + Name ()); TempCount = StaticVarGet ( "CoverCount" + Name ()); CoverPrevTemp = 0; for (i = 0; i <= TempCount; i++) { CoverPrevTemp = CoverPrevTemp | ( IIF ( DateTime () == CoverTempData[i], True , False )); } TempCount = StaticVarGet ( "ShortCount" + Name ()); Cover = IIF ((TempCount > 0) && ((CoverPrevTemp == True ) || (TempCover == True )), True , False ); } if (StrategyType == "Long" ) { Short = 0; Cover = 0; } else if (StrategyType == "Short" ) { Buy = 0; Sell = 0; } Buy = ExRem ( Buy , Sell ); Sell = ExRem ( Sell , Buy ); Short = ExRem ( Short , Cover ); Cover = ExRem ( Cover , Short ); Buyshape = Buy * shapeUpArrow ; SellShape = Sell * shapeDownArrow ; PlotShapes ( Buyshape, colorBrightGreen , 0, Low ); PlotShapes ( SellShape, colorRed , 0, High ); Shortshape = Short * shapeDownArrow ; CoverShape = Cover * shapeUpArrow ; PlotShapes ( Shortshape, colorOrange , 0, High , -30); PlotShapes ( CoverShape, colorTurquoise , 0, Low , -30 ); GraphXSpace = 5; if (EnableRealTimeControl == "Yes" ) { if (( LastValue ( Buy ) == True ) && ( StaticVarGet (( "BuyFlag" + Name ())) != LastValue ( DateTime ()))) { StaticVarSet (( "BuyFlag" + Name ()), LastValue ( DateTime ())); DrawBut( "Buy" , X0+X1+10, Y0, X0+X1+75, Y0+30, colorGrey40 , colorGrey40 ); TempCount = StaticVarGet ( "BuyCount" + Name ()); TempIndex = StaticVarGet ( "BuyIndex" + Name ()); TempPrice = StaticVarGet ( "BuyPrice" + Name ()); TempQty = StaticVarGet ( "BuyQty" + Name ()); TempIndex[TempCount] = LastValue ( DateTime ()); TempPrice[TempCount] = BuyPriceValue; TempQty[TempCount] = LotQuantity; TempCount++; StaticVarSet ( "BuyCount" + Name (), TempCount); StaticVarSet (( "BuyIndex" + Name ()), TempIndex); StaticVarSet (( "BuyPrice" + Name ()), TempPrice); StaticVarSet (( "BuyQty" + Name ()), TempQty); if (EnableAutoTrade == "Yes" ) { LastOrderNo = StaticVarGet ( "OrderNo" ); LastOrderNo++; StaticVarSet ( "OrderNo" , LastOrderNo); TempOrderNo = ClientIdValue + NumToStr ( Now (3),1,0) + "00" + LastOrderNo; TempName = Name () + "-EQ" ; nestplus.PlaceOrder( "BUY" , TempOrderNo, "NSE" , TempName, "DAY" , OrderType, LotQuantity, BuyPriceValue, 0.0, 0, ProductType, ClientIdValue); } } if (( LastValue ( Sell ) == True ) && ( StaticVarGet (( "SellFlag" + Name ())) != LastValue ( DateTime ()))) { StaticVarSet (( "SellFlag" + Name ()), LastValue ( DateTime ())); DrawBut( "Sell" , X0+X1+10, Y0, X0+X1+75, Y0+30, colorGrey40 , colorGrey40 ); TempCount = StaticVarGet ( "SellCount" + Name ()); TempIndex = StaticVarGet ( "SellIndex" + Name ()); TempPrice = StaticVarGet ( "SellPrice" + Name ()); TempQty = StaticVarGet ( "SellQty" + Name ()); TempIndex[TempCount] = LastValue ( DateTime ()); TempPrice[TempCount] = SellPriceValue; TempQty[TempCount] = LotQuantity; TempCount++; StaticVarSet ( "SellCount" + Name (), TempCount); StaticVarSet (( "SellIndex" + Name ()), TempIndex); StaticVarSet (( "SellPrice" + Name ()), TempPrice); StaticVarSet (( "SellQty" + Name ()), TempQty); if (EnableAutoTrade == "Yes" ) { LastOrderNo = StaticVarGet ( "OrderNo" ); LastOrderNo++; StaticVarSet ( "OrderNo" , LastOrderNo, 1); TempOrderNo = ClientIdValue + NumToStr ( Now (3),1,0) + "00" + LastOrderNo; TempName = Name () + "-EQ" ; nestplus.PlaceOrder( "SELL" , TempOrderNo, "NSE" , TempName, "DAY" , OrderType, LotQuantity, SellPriceValue, 0.0, 0, ProductType, ClientIdValue); } } if (( LastValue ( Short ) == True ) && ( StaticVarGet (( "ShortFlag" + Name ())) != LastValue ( DateTime ()))) { StaticVarSet (( "ShortFlag" + Name ()), LastValue ( DateTime ())); DrawBut( "Short" , X0+X1+10, Y0, X0+X1+75, Y0+30, colorGrey40 , colorGrey40 ); TempCount = StaticVarGet ( "ShortCount" + Name ()); TempIndex = StaticVarGet ( "ShortIndex" + Name ()); TempPrice = StaticVarGet ( "ShortPrice" + Name ()); TempQty = StaticVarGet ( "ShortQty" + Name ()); TempIndex[TempCount] = LastValue ( DateTime ()); TempPrice[TempCount] = SellPriceValue; TempQty[TempCount] = LotQuantity; TempCount++; StaticVarSet ( "ShortCount" + Name (), TempCount); StaticVarSet (( "ShortIndex" + Name ()), TempIndex); StaticVarSet (( "ShortPrice" + Name ()), TempPrice); StaticVarSet (( "ShortQty" + Name ()), TempQty); if (EnableAutoTrade == "Yes" ) { LastOrderNo = StaticVarGet ( "OrderNo" ); LastOrderNo++; StaticVarSet ( "OrderNo" , LastOrderNo); TempOrderNo = ClientIdValue + NumToStr ( Now (3),1,0) + "00" + LastOrderNo; TempName = Name () + "-EQ" ; nestplus.PlaceOrder( "SELL" , TempOrderNo, "NSE" , TempName, "DAY" , OrderType, LotQuantity, SellPriceValue, 0.0, 0, ProductType, ClientIdValue); } } if (( LastValue ( Cover ) == True ) && ( StaticVarGet (( "CoverFlag" + Name ())) != LastValue ( DateTime ()))) { StaticVarSet (( "CoverFlag" + Name ()), LastValue ( DateTime ())); DrawBut( "Cover" , X0+X1+10, Y0, X0+X1+75, Y0+30, colorGrey40 , colorGrey40 ); TempCount = StaticVarGet ( "CoverCount" + Name ()); TempIndex = StaticVarGet ( "CoverIndex" + Name ()); TempPrice = StaticVarGet ( "CoverPrice" + Name ()); TempQty = StaticVarGet ( "CoverQty" + Name ()); TempIndex[TempCount] = LastValue ( DateTime ()); TempPrice[TempCount] = BuyPriceValue; TempQty[TempCount] = LotQuantity; TempCount++; StaticVarSet ( "CoverCount" + Name (), TempCount); StaticVarSet (( "CoverIndex" + Name ()), TempIndex); StaticVarSet (( "CoverPrice" + Name ()), TempPrice); StaticVarSet (( "CoverQty" + Name ()), TempQty); if (EnableAutoTrade == "Yes" ) { LastOrderNo = StaticVarGet ( "OrderNo" ); LastOrderNo++; StaticVarSet ( "OrderNo" , LastOrderNo, 1); TempOrderNo = ClientIdValue + NumToStr ( Now (3),1,0) + "00" + LastOrderNo; TempName = Name () + "-EQ" ; nestplus.PlaceOrder( "BUY" , TempOrderNo, "NSE" , TempName, "DAY" , OrderType, LotQuantity, BuyPriceValue, 0.0, 0, ProductType, ClientIdValue); } } } X0 = 180; Y0 = 30; if (EnableRealTimeControl == "Yes" ) { TotPrice = 0; TotQty = 0; TotVal = 0; TempPriceArray = StaticVarGet ( "BuyPrice" + Name ()); TempQtyArray = StaticVarGet ( "BuyQty" + Name ()); TempCount = StaticVarGet ( "BuyCount" + Name ()); for (i = 0; i < TempCount; i++) { TotPrice = TotPrice + TempPriceArray[i]; TotQty = TotQty + TempQtyArray[i]; TotVal = TotVal + TempPriceArray[i] * TempQtyArray[i]; } if (TempCount == 0) { AvgBuyPrice = 0; LastBuyPrice = 0; LastBuyQty = 0; } else { AvgBuyPrice = (TotPrice / TempCount); LastBuyPrice = TempPriceArray[(TempCount - 1)]; LastBuyQty = NumToStr (TempQtyArray[(TempCount - 1)], 1, 0); } TotBuyQty = NumToStr (TotQty, 1, 0); NetBuyQty = TotQty; NetBuyValue = TotVal; TotPrice = 0; TotQty = 0; TotVal = 0; TempPriceArray = StaticVarGet ( "SellPrice" + Name ()); TempQtyArray = StaticVarGet ( "SellQty" + Name ()); TempCount = StaticVarGet ( "SellCount" + Name ()); for (i = 0; i < TempCount; i++) { TotPrice = TotPrice + TempPriceArray[i]; TotQty = TotQty + TempQtyArray[i]; TotVal = TotVal + TempPriceArray[i] * TempQtyArray[i]; } if (TempCount == 0) { AvgSellPrice = 0; LastSellPrice = 0; LastSellQty = 0; } else { AvgSellPrice = (TotPrice / TempCount); LastSellPrice = TempPriceArray[(TempCount - 1)]; LastSellQty = NumToStr (TempQtyArray[(TempCount - 1)], 1, 0); } TotSellQty = NumToStr (TotQty, 1, 0); NetSellQty = TotQty; NetSellValue = TotVal; TotPrice = 0; TotQty = 0; TotVal = 0; TempPriceArray = StaticVarGet ( "ShortPrice" + Name ()); TempQtyArray = StaticVarGet ( "ShortQty" + Name ()); TempCount = StaticVarGet ( "ShortCount" + Name ()); for (i = 0; i < TempCount; i++) { TotPrice = TotPrice + TempPriceArray[i]; TotQty = TotQty + TempQtyArray[i]; TotVal = TotVal + TempPriceArray[i] * TempQtyArray[i]; } if (TempCount == 0) { AvgShortPrice = 0; LastShortPrice = 0; LastShortQty = 0; } else { AvgShortPrice = (TotPrice / TempCount); LastShortPrice = TempPriceArray[(TempCount - 1)]; LastShortQty = NumToStr (TempQtyArray[(TempCount - 1)], 1, 0); } TotShortQty = NumToStr (TotQty, 1, 0); NetShortQty = TotQty; NetShortValue = TotVal; TotPrice = 0; TotQty = 0; TotVal = 0; TempPriceArray = StaticVarGet ( "CoverPrice" + Name ()); TempQtyArray = StaticVarGet ( "CoverQty" + Name ()); TempCount = StaticVarGet ( "CoverCount" + Name ()); for (i = 0; i < TempCount; i++) { TotPrice = TotPrice + TempPriceArray[i]; TotQty = TotQty + TempQtyArray[i]; TotVal = TotVal + TempPriceArray[i] * TempQtyArray[i]; } if (TempCount == 0) { AvgCoverPrice = 0; LastCoverPrice = 0; LastCoverQty = 0; } else { AvgCoverPrice = (TotPrice / TempCount); LastCoverPrice = TempPriceArray[(TempCount - 1)]; LastCoverQty = NumToStr (TempQtyArray[(TempCount - 1)], 1, 0); } TotCoverQty = NumToStr (TotQty, 1, 0); NetCoverQty = TotQty; NetCoverValue = TotVal; NetQty = NetSellQty - NetBuyQty + NetShortQty - NetCoverQty; NetValue = NetSellValue - NetBuyValue + NetShortValue - NetCoverValue; NetQuantityColor = colorGrey40 ; NetValueColor = colorGrey40 ; if (NetQty > 0) { NetQuantityColor = colorRed ; NetValueColor = colorRed ; } else if (NetQty < 0) { NetQuantityColor = colorGreen ; NetValueColor = colorGreen ; } else if (NetQty == 0) { if (NetValue > 0) { NetValueColor = colorGreen ; } else if (NetValue < 0) { NetValueColor = colorRed ; } } DrawData ( " AvgBuyPr: " + AvgBuyPrice, X0, Y0, X0+150, Y0+15, colorGrey40 , colorGrey40 ); DrawData ( " TotBuyQty: " + TotBuyQty, X0+155 , Y0, X0+305, Y0+15, colorGrey40 , colorGrey40 ); DrawData ( " AvgSellPr: " + AvgSellPrice, X0+310, Y0, X0+460, Y0+15, colorGrey40 , colorGrey40 ); DrawData ( " TotSellQty: " + TotSellQty, X0+465, Y0, X0+615, Y0+15, colorGrey40 , colorGrey40 ); DrawData ( " AvgShortPr: " + AvgShortPrice, X0+620, Y0, X0+770, Y0+15, colorGrey40 , colorGrey40 ); DrawData ( " TotShortQty: " + TotShortQty, X0+775 , Y0, X0+925, Y0+15, colorGrey40 , colorGrey40 ); DrawData ( " AvgCoverPr: " + AvgCoverPrice, X0+930, Y0, X0+1080, Y0+15, colorGrey40 , colorGrey40 ); DrawData ( " TotCoverQty: " + TotCoverQty, X0+1085, Y0, X0+1235, Y0+15, colorGrey40 , colorGrey40 ); Y0 = 50; DrawData ( " LastBuyPr: " + LastBuyPrice, X0, Y0, X0+150, Y0+15, colorGrey40 , colorGrey40 ); DrawData ( " LastBuyQty: " + LastBuyQty, X0+155 , Y0, X0+305, Y0+15, colorGrey40 , colorGrey40 ); DrawData ( " LastSellPr: " + LastSellPrice, X0+310, Y0, X0+460, Y0+15, colorGrey40 , colorGrey40 ); DrawData ( " LastSellQty: " + LastSellQty, X0+465, Y0, X0+615, Y0+15, colorGrey40 , colorGrey40 ); DrawData ( " LastShortPr: " + LastShortPrice, X0+620, Y0, X0+770, Y0+15, colorGrey40 , colorGrey40 ); DrawData ( " LastShortQty: " + LastShortQty, X0+775 , Y0, X0+925, Y0+15, colorGrey40 , colorGrey40 ); DrawData ( " LastCoverPr: " + LastCoverPrice, X0+930, Y0, X0+1080, Y0+15, colorGrey40 , colorGrey40 ); DrawData ( " LastCoverQty: " + LastCoverQty, X0+1085, Y0, X0+1235, Y0+15, colorGrey40 , colorGrey40 ); Y0 = 70; DrawData ( " LTP : " + CurrentTradedPrice, X0, Y0, X0+125, Y0+15, LTPColor, LTPColor); DrawData ( " LTQ : " + NumToStr (CurrentLTQ,1,0), X0+130, Y0, X0+255, Y0+15, LTQColor, LTQColor); DrawData ( " Bid : " + CurrentBidPrice, X0+260, Y0, X0+385, Y0+15, AskColor, AskColor); DrawData ( " Ask : " + CurrentAskPrice, X0+390, Y0, X0+515, Y0+15, BidColor, BidColor); NestOredrNo = ClientIdValue + NumToStr ( Now (3),1,0) + "00" + StaticVarGet ( "OrderNo" ); DrawData ( " NetQty : " + NetQty, X0+520, Y0, X0+670, Y0+15, NetQuantityColor, NetQuantityColor); DrawData ( " NetValue : " + NetValue, X0+675, Y0, X0+900, Y0+15, NetValueColor, NetValueColor); DrawData ( " Order No : " + NestOredrNo, X0+905, Y0, X0+1150, Y0+15, colorGrey40 , colorGrey40 ); } _SECTION_END (); // ~~~~~~~~~~~~~~~~ Quote Display Draw ~~~~~~~~~~~~~~~~~// _SECTION_BEGIN ( "Price" ); SetChartOptions (0, chartShowArrows | chartShowDates ); //_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} \nOpen : %g, Close : %g (%.1f%%) \nLow : %g, High : %g (%.1f%%) \nVolume : " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, C,(((C-O)*100)/O), L, H, (((H-L)*100)/L) )); Plot ( C , "Close" , ParamColor ( "Color" , colorDefault ), styleNoTitle | ParamStyle ( "Style" ) | GetPriceStyle () ); _SECTION_END (); _SECTION_BEGIN ( "MA" ); P = ParamField ( "Price field" ,-1); Periods = Param ( "Periods" , 10, 2, 200, 1 ); Plot ( MA ( P, Periods ), /*_DEFAULT_NAME()*/ "" , ParamColor ( "Color" , colorGreen ), ParamStyle ( "Style" , styleLine | styleNoLabel ) | styleNoRescale ); _SECTION_END (); _SECTION_BEGIN ( "EMA" ); P = ParamField ( "Price field" ,-1); Periods = Param ( "Periods" , 30, 2, 300, 1, 10 ); Plot ( EMA ( P, Periods ), /*_DEFAULT_NAME()*/ "" , ParamColor ( "Color" , colorOrange ), ParamStyle ( "Style" , styleLine | styleNoLabel ) | styleNoRescale ); _SECTION_END (); _SECTION_BEGIN ( "Long MA" ); P = ParamField ( "Price field" ,-1); Periods = Param ( "Periods" , 45, 2, 400, 1 ); Plot ( MA ( P, Periods ), /*_DEFAULT_NAME()*/ "" , ParamColor ( "Color" , colorYellow ), ParamStyle ( "Style" , styleLine | styleNoLabel ) | styleNoRescale ); _SECTION_END (); _SECTION_BEGIN ( "BBands" ); P = ParamField ( "Price field" ,-1); Periods = Param ( "Periods" , 15, 2, 100, 1 ); Width = Param ( "Width" , 2, 0, 10, 0.05 ); Color = ParamColor ( "Color" , colorLightGrey ); Color = ColorBlend( Color, GetChartBkColor (), 0.5 ); Style = ParamStyle ( "Style" , styleLine | styleNoLabel ) | styleNoRescale ;; Plot ( bbt = BBandTop ( P, Periods, Width ), /*"BBTop" + _PARAM_VALUES()*/ "" , Color, Style ); Plot ( bbb = BBandBot ( P, Periods, Width ), /*"BBBot" + _PARAM_VALUES()*/ "" , Color, Style ); PlotOHLC ( bbt, bbt, bbb, bbb, "" , ColorBlend( Color, GetChartBkColor (), 0.7 ), styleNoLabel | styleCloud | styleNoRescale , Null , Null , Null , -1 ); _SECTION_END (); _SECTION_BEGIN ( "Volume" ); Color = ParamColor ( "Color" , ColorRGB ( 128, 128, 192 ) ); Plot ( Volume , /*_DEFAULT_NAME()*/ "" , ColorBlend( Color, GetChartBkColor (), 0.2 ), styleNoTitle | ParamStyle ( "Style" , styleHistogram | styleOwnScale | styleThick | styleNoLabel , maskHistogram ), 2 ); _SECTION_END (); |
26 comments
Leave Comment
Please login here to leave a comment.
Back
Thanks ranji sir really good stuff
Ranji sir,
pls post your mail id to contact you or your official no for business model
Add the below code after the mentioned lines.
Add below 6th line. ie –
StrategyType = ParamList(“StrategyType”, “Long/Short|Long|Short”, 0);
ActiveTrade = ParamList("Active Trade", "Good To Go|Close Positions", 0);
Add Bellow 321th line ie-
if (ClearButtonClick || NumPad0 )
{
DrawBut(“Clear”, X0+X1+10, Y0, X0+X1+75, Y0+30, colorGrey40, colorGrey40);
StaticVarSetText("firstflag"+Name(), "");
}
if(ActiveTrade == "Close Positions")
{
ActiveTradeBuyCount = StaticVarGet("BuyCount" + Name());
ActiveTradeSellCount = StaticVarGet("SellCount" + Name());
ActiveTradeShortCount = StaticVarGet("ShortCount" + Name());
ActiveTradeCoverCount = StaticVarGet("CoverCount" + Name());
if((ActiveTradeBuyCount - ActiveTradeSellCount) == 0)
{
Buy = 0;
Sell = 0;
}
else if((ActiveTradeBuyCount - ActiveTradeSellCount) > 0)
{
Buy = 0;
}
else
{
Sell = 0;
}
if((ActiveTradeShortCount - ActiveTradeCoverCount) == 0)
{
Short = 0;
Cover = 0;
}
else if((ActiveTradeShortCount - ActiveTradeCoverCount) > 0)
{
Short = 0;
}
else
{
Cover = 0;
}
}
This will give a control for closing the all opened trades. If you select “Close Poisons” in parameters, afl will close the opened poisons on the next strategy signal or manual signal and no more buy/sell/short/cover signals will produce.
My mail ID is ranjicgnr@gmail.com
Thanks Ranji. The GetAsyncKeyState() function was not working in my ami 5.50. Apart from that, working fine. Thanks again for open-source coding
Hai aroonsankar.
Yes. GetAsyncKeyState() is a latest command in afl 3.6 on-words. Comment it and only keyboard shortcut will not work. Comment the if statement also.
Ranji,
Staticvarset() and StaticvarsetText()are used in this afl. As you know, the third parameter is not valid in versions below 5.70. If the third parameter is removed from the code, what will be its implication on result? Is the third parameter is meant for delivery buys or will have an effect on intraday positions?
Dear AroonSankar,
Staticvarset() and StaticvarsetText() are save to memory commands. It saves the date to static memory. The third parameter is for persistence. That means static memory will be removed ones you close the program(Amibroker). If the persistence is enabled amibroker saves the data in a file and the saved value is used in the next time program opens. Its only for saving data from program close to program open. It wont have any effect on intraday buy.
Delivery buys can be done by selecting the option in the parameter “Product type” as “NRML”.
Dear Admin / Ranji,
Nice AFL to trade with Auto Trade
Can you please combine full AFL and post here or send me email as we are not expert so as u say place this command on line no 6 & line no 321
Still getting error at line no 258 NumPad0 = GetAsyncKeyState(96) < 0;
And if i placed this AFL (auto trade) on AFL it gave errors….
So my request please post full afl with corrections needed or email me am in badly need for the same.
dalalviral@yahoo.com
Thanks sir,
when i try to run with 5.60ver i am getting following error, kindly help me
Auto_Trade_New1:
nestplus = CreateStaticObject(“Nest.PlusApi”);
nestplus.SetObjectName(“RKRAutoTrade”);
}
StaticVarSetText (“firstflagforNest”,“0”, 1);
-———————————-File:’Formulas\Custom\Auto_Trade_New1 1.afl,Ln:53,Col:45
Error 16
Too many arguments
Use ‘Edit Formula’ to correct error’
Hai Arun.victor
Change the statement as
StaticVarSetText (“firstflagforNest”,“0”);
.Ie Delete the last parameter. This will work in old versions of amibroker. Also if you are getting error in
NumPad0 = GetAsyncKeyState(96) < 0;
NumPad4 = GetAsyncKeyState(100) < 0;
NumPad5 = GetAsyncKeyState(101) < 0;
NumPad7 = GetAsyncKeyState(103) < 0;
NumPad8 = GetAsyncKeyState(104) < 0;
Delete the above statements
Change the below statements to
if (BuyButtonClick || NumPad7 )
→if (BuyButtonClick)
if (SellButtonClick || NumPad8)
→if (SellButtonClick)
if (ShortButtonClick || NumPad4)
→if (ShortButtonClick)
if (CoverButtonClick || NumPad5)
→if (CoverButtonClick)
if (ClearButtonClick || NumPad0 )
→if (ClearButtonClick)
Only keyboard shortcuts will not work by changing this.
Dear Sir,
Thanks for quick replay and thanks for great help…
As per your instructions I have modified the codes and try to run once again, but still I am following getting error, I have AmiBroker 5.60v, kindly help me
===========
TempOrderNo = ClientIdValue + NumToStr(Now(3),1,0) + “00” + LastOrderNo;
TempName = Name() + “-EQ”;
nestplus.PlaceOrder(“BUY”, TempOrderNo, “NSE”, TempName, “DAY”, OrderType, LotQuantity, SellPriceValue, 0.0, 0, ProductType, ClientIdValue);
-———————————————————————————————————————-’File:’Formulas\Custom\Auto_Trade_New1 1.afl,Ln:461,Col:141
Error 18
COM object variable is not initialized or has invalid type (Valid COM Object handle required)
Use ‘Edit Formula’ to correct error’
Thanks in advance,
Arun
Dear Sir,
First of All thanks so much for such a lovely gift to traders community.
a) I want to run it in a manner so that order is punched for BUY at High Signal Candle and SELL at Low of Signal Candle.
Does it require any change in Codes so that above is implemented.
b) I tried it today, somehow observed that orders are not going into NEST. Please advise way out.
Thanks.
sir..
i an new
is its work in odin also pls explain….
Dear Pkgmtnl,
Are you ensured you have nest plus api in your NEST and loged in to that. Also another thing it is not fully automated. You will get the oredr reflection in the API window.
If you need any help, mail me or call me.
Dear jayasingh,
This will not work for ODIN. It is only for NEST.
DEAR RANJIC
I NEED SOME GOOD AFL FOR TRADING
CAN U HELP ME OUT
devasenaupa@gmail.com
for full automation, please contact me ranjicgnr@gmail.com
Sir some error showing please help how to remove it
Auto BUY SELL NestTrader:
if(ClearButtonClick||Numpad0)
{
DrawBut("
-———-^Syntex error:unexpected
Pls include the stoploss with % so that it will help lot for the trading…..
great… hardwork…
Sir , First of all congrats for your great effort,,, in my system symbols name is different from the broker and data provider , what can i do? Please help,,
can you correct the afl with all changes and post again plz
thankyou
Hi Ranjicgnr,
Could you please provide modify this afl to connect to ODIN Diet? if so it would be of great help.
thanks
The modified code is compatible to odin diet also . It is working well.
Thanks to ranjith. Good effort
Updated new auto trading control is awesome…
Good effort Mr.ranjith
SIR IAM NEW TRADER I HAVE TRADING ACCOUNT WITH SASONLINE AND MY TERMINAL IS NESTTRADER PLEASE GUIDE ME HOW TO USE THIS