//www.aflcode.com _SECTION_BEGIN("Price"); SetChartOptions(0,chartShowArrows|chartShowDates|chartLogarithmic| chartWrapTitle); _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) )); Plot( C, "Close", ParamColor("Color", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); _SECTION_END(); riskAmount=Param("Risk Amount",25,10,10000,5); Limit=Param(" Trade Till (Hour)(Min)(Sec)",145900,103000,153000,100); since=(TimeNum() >= 101459 AND TimeNum()<= Limit) AND (DateNum()==LastValue(DateNum())); _SECTION_BEGIN("Alerts"); SRbS = ParamToggle("S/R broken","Off,On",1); SRcS = ParamToggle("S/R confirmed","Off,On",1); PjabS = ParamToggle("Price just above/below","Off,On",1); _SECTION_END(); _SECTION_BEGIN("Main Parameters"); PlotP1P2 = ParamToggle("Plot P1/P2 Shapes","Off,On",1); P1Shape = Param("P1 Shape Typ",35,0,50,1);//default 35 P2Shape = Param("P2 Shape Typ",37,0,50,1);//default 37 Parallellinesswitch = ParamToggle("Plot Parallel Lines","Off,On",1); DisRange = Param("Plot Parallel Lines Trigger",300,0,1000,20); _SECTION_BEGIN("Styles"); Style_SL= ParamStyle("Support",styleLine+styleThick,maskDefault)+styleNoRescale; Style_RL= ParamStyle("Resistance",styleLine+styleThick,maskDefault)+styleNoRescale; Style_PHL= ParamStyle("Parallel Support",styleLine+styleDashed,maskDefault)+styleNoRescale; Style_PLL= ParamStyle("Parallel Resistance",styleLine+styleDashed,maskDefault)+styleNoRescale; _SECTION_END(); _SECTION_BEGIN("Colors"); Color_SL= ParamColor("Support",colorLime); Color_RL= ParamColor("Resistance",colorRed); Shadowcolor = ParamColor("Shadow",ColorRGB(56,63,118)); if(Version()<4.75){Backgroundcolor = ParamColor("Your Background",colorBlack);} Color_PLL= Color_RL; //ParamColor("Resistance",colorRed); Color_PHL= Color_SL; //ParamColor("Support",colorLime); _SECTION_END(); _SECTION_BEGIN("Pattern Selection"); AscTs = ParamToggle("Ascending Triangle","Off,On",1); DscTs = ParamToggle("Descending Triangle","Off,On",1); STs = ParamToggle("Symmetrically Triangle","Off,On",1); ETs = ParamToggle("Expanding Triangle","Off,On",1); RWs = ParamToggle("Rising Wedge","Off,On",1); FWs = ParamToggle("Falling Wedge","Off,On",1); UTs = ParamToggle("Up Trend","Off,On",1); DTs = ParamToggle("Down Trend","Off,On",1); Ranges = ParamToggle("Range","Off,On",1); NonDefinedPatterns = ParamToggle("Not defined Patterns","Off,On",1); _SECTION_END(); Plot( OBV(), _DEFAULT_NAME(), ParamColor("Color", colorCycle ), styleDashed| styleOwnScale | styleThick | styleNoLabel ); //calcs HH = HHV(H,20); LL = LLV(L,20); Mid = LL+((HH-LL)/2); Div = 100-(HH/(0.01*Mid)); Per = LastValue(abs(Div)); Hp1 = Ref(H,-1);Hp2 = Ref(H,-2);Hp3 = Ref(H,-3);Hp4 = Ref(H,-4);Hp5 = Ref(H,-5);Hp6 = Ref(H,-6); Lp1 = Ref(L,-1);Lp2 = Ref(L,-2);Lp3 = Ref(L,-3);Lp4 = Ref(L,-4);Lp5 = Ref(L,-5);Lp6 = Ref(L,-6); Hf1 = Ref(H,1);Hf2 = Ref(H,2);Hf3 = Ref(H,3);Hf4 = Ref(H,4);Hf5 = Ref(H,5);Hf6 = Ref(H,6); Lf1 = Ref(L,1);Lf2 = Ref(L,2);Lf3 = Ref(L,3);Lf4 = Ref(L,4);Lf5 = Ref(L,5);Lf6 = Ref(L,6); x = Cum(1); divx = LastValue(x)-x; //Tops A = H; Top1 = A > Hf2 & A > Hf1 & A > Hp1 & A > Hp2 & divx>2; Top2 = A > Hf3 & A > Hf2 & A ==Hf1 & A > Hp1 & A > Hp2 & divx>3 ; Top3 = A > Hf4 & A > Hf3 & A ==Hf2 & A >=Hf1 & A > Hp1 & A > Hp2 & divx>4; Top4 = A > Hf5 & A > Hf4 & A ==Hf3 & A >=Hf2 & A >=Hf1 & A > Hp1 & A > Hp2 & divx>5; Top5 = A > Hf6 & A > Hf5 & A ==Hf4 & A >=Hf3 & A ==Hf2 & A >=Hf1 & A > Hp1 & A >Hp2 & divx>6; Top = Top1 OR Top2 OR Top3 OR Top4 OR Top5; TopHigh = ValueWhen(Top,H); TopX = ValueWhen(Top,X); //Valleys A = L; Valley1 = A < Lf2 & A <= Lf1 & A <= Lp1 & A < Lp2 & divx>2; Valley2 = A < Lf3 & A < Lf2 & A == Lf1 & A < Lp1 & A < Lp2 & divx>3; Valley3 = A < Lf4 & A < Lf3 & A == Lf2 & A <= Lf1 & A < Lp1 & A < Lp2 & divx>4; Valley4 = A < Lf5 & A < Lf4 & A == Lf3 & A <= Lf2 & A <= Lf1 & A < Lp1 & A < Lp2 & divx>5; Valley5 = A < Lf6 & A < Lf5 & A == Lf4 & A <= Lf3 & A == Lf2 & A <= Lf1 & A < Lp1 & A < Lp2 & divx>6; Valley = Valley1 OR Valley2 OR Valley3 OR Valley4 OR Valley4 OR Valley5; ValleyLow = ValueWhen(Valley,L); ValleyX = ValueWhen(Valley,X); x = Cum(1); xb = LastValue(ValueWhen(Valley,x,1)); xa = LastValue(ValueWhen(Valley,x,2)); yb = LastValue(ValueWhen(Valley,L,1)); Ya = LastValue(ValueWhen(Valley,L,2)); xab_log = log(yb/yA)/(xb-xa); SL = exp((x-xb)*xab_log)*yb; RocSL = ROC(SL,1); xd = LastValue(ValueWhen(top,x,1)); xc = LastValue(ValueWhen(top,x,2)); yd = LastValue(ValueWhen(top,H,1)); Yc = LastValue(ValueWhen(top,H,2)); xcd_log = log(yd/yc)/(xd-xc); RL = exp((x-xd)*xcd_log)*yd; RocRL = ROC(RL,1); //LPL Low_Value = LastValue(Ref(LLV(L,xd-xc),-(x-xd))); x2 = LastValue(ValueWhen(L==Low_Value & x>xc & x<xd,x)); PLL = IIf(LastValue(x)-x2>5,exp((x-x2)*xcd_log)*Low_Value,-1e10); //HPL Hi_Value = LastValue(Ref(HHV(H,xb-xa),-(x-xb))); x3 = LastValue(ValueWhen(H==Hi_Value & x>xa & x<xb,x)); PHL = IIf(LastValue(x)-x3>5,exp((x-x3)*xab_log)*Hi_Value,-1e10); //Channels AvgRoc = abs(MA(ROC(C,1),100)); Threshold_parallel = 15; Threshold_Trend = 0.001*per; SLabs = SL-Ref(SL,-1); RLabs = RL-Ref(RL,-1); ROC2SL = (SLabs/C)*100; ROC2RL = (RLabs/C)*100; RSL = ROC2SL > Threshold_Trend; FlatSL = abs(ROC2SL) < Threshold_Trend; FSL = ROC2SL < -Threshold_Trend; RRL = ROC2RL > Threshold_Trend; FlatRL = abs(ROC2RL) < Threshold_Trend; FRL = ROC2RL < -Threshold_Trend; parallel= abs(((RocSL/RocRL)-1)*100)<Threshold_parallel; UT= RSL AND RRL AND parallel; DT= FSL AND FRL AND parallel; DT_UT = IIf (DT,-1,IIf(UT,1,0)); Range = parallel AND FlatSL AND FlatRL; Xm = xb-xa >4 & xd-xc >4; //x-min.distance - optional AscT= FlatRL & RSL;// & xa<xd & xc<xb;// & Xm; DscT= FlatSL & FRL;// & xa<xd & xc<xb;// & Xm; AT_DT= IIf(AscT,1,IIf(DscT,-1,0)); ST = RSL & FRL & RL>SL;//& xa<xd & xc<xb;// & Xm; ET = RRL & FSL & RL>SL;//& xa<xd & xc<xb;// & Xm;//abs(ROCSL/ROCRL)<3 - optional ST_ET = IIf(ST,1,IIf(ET,-1,0)); RW = RRL & RSL & RocSL>RocRL & SL>RL AND NOT parallel;// & Xm; FW = FSL & FRL & RocRL<RocSL & SL<RL AND NOT parallel;// & Xm; RW_FW = IIf (RW,1,IIf(FW,-1,0)); Distance = 0.5*ATR(14); //Support line signals Sup_break = Cross(SL,C) & X>XB; Sup_pricejustabove = L<SL+Distance & L>SL & X>XB; Sup_confirmed = L<=SL & C>SL & X>XB; //Resistance line signals Res_break = Cross(C,RL) & X>XD; Res_pricejustbelow = H>RL-Distance & H<RL & X>XD; Res_confirmed = H>=RL & C<RL & X>XD; //Parallel lower line signals PLL_break = Cross(PLL,C); PLL_pricejustabove = L<PLL+Distance & L>PLL; PLL_confirmed = L<=PLL & C>PLL; //Parallel higher line signals PHL_break = Cross(C,PHL); PHL_pricejustbelow = H>PHL-Distance & H<PHL; PHL_confirmed = H>=PHL & C<PHL; SupSignals = Sup_break | Sup_pricejustabove | Sup_confirmed; ResSignals = Res_break | Res_pricejustbelow | Res_confirmed; PLLSignals = PLL_break | PLL_pricejustabove | PLL_confirmed; PHLSignals = PHL_break | PHL_pricejustbelow | PHL_confirmed; //BS = Sup_confirmed OR Res_break; //SS = Res_confirmed OR Sup_break; BS = Sup_confirmed OR Sup_pricejustabove OR Res_break; SS = Res_confirmed OR Res_pricejustbelow OR Sup_break; NS = Sup_pricejustabove OR Res_pricejustbelow; PatternDirection = IIf(AscT|FW|UT,1, IIf(DscT|RW|DT,-1, IIf(ST|ET|Range,0,0))); PatternText = WriteIf(LastValue(AscT),"Ascending Triangle", WriteIf(LastValue(DscT),"Decending Triangle", WriteIf(LastValue(ST),"Symmetrical Triangle", WriteIf(LastValue(ET),"Expanding Triangle", WriteIf(LastValue(RW),"Rising Wedge", WriteIf(LastValue(FW),"Falling Wedge", WriteIf(LastValue(UT),"Up Channel", WriteIf(LastValue(DT),"Down Channel", WriteIf(Range,"Range","Not defined"))))))))); //Display Cond. fix when Chart is compl.zoomed out PLLd = abs((LastValue(C)/LastValue(PLL))-1)<0.01*DisRange; PHLd = abs((LastValue(C)/LastValue(PHL))-1)<0.01*DisRange; barvisible = Status("barvisible"); firstvisiblebar = barvisible & NOT Ref(barvisible,-1); HHvisible = LastValue(HighestSince(firstvisiblebar,High)); LLvisible = LastValue(LowestSince(firstvisiblebar,Low)); RaH = HHvisible *1.05; //Range High RaL = LLVisible *0.95; //Range Low //Anyline_zero AnZ= ya==0 OR yb==0 OR yc==0 OR yd==0; SL_plot = IIf(x>=xa & SL>RaL & SL<RaH & NOT AnZ,SL,IIf(x>=xa & RaL==0 & NOT AnZ,SL,-1e10)); RL_plot = IIf(x>=xc & RL>RaL & RL<RaH & NOT AnZ,RL,IIf(x>=xc & RaL==0 & NOT AnZ,RL,-1e10)); PLL_plot = IIf(x-x2>=0 & abs(LastValue(L/PLL)-1) <abs(LastValue((DisRange/1000)*ATR(14))) & PLL>RaL & PLL<RaH & NOT AnZ,PLL,IIf(x-x2>=0 & RaL==0 & PLLd & abs(LastValue(L/PLL)-1) <abs(LastValue((DisRange/1000)*ATR(14)))& NOT AnZ,PLL,-1e10)); PHL_plot = IIf(x-x3>=0 & abs(LastValue(H/PHL)-1) <abs(LastValue((DisRange/1000)*ATR(14))) & PHL>RaL & PHL<RaH & NOT AnZ,PHL,IIf(x-x3>=0 & RaL==0 & PHLd & abs(LastValue(H/PHL)-1) <abs(LastValue((DisRange/1000)*ATR(14)))& NOT AnZ,PHL,-1e10)); ///////////Begin Ploting Part//////////// LastBar = Cum(1) == LastValue(Cum(1)); Plot(SL_plot ," SL" ,Color_SL,Style_SL+styleNoTitle); Plot(RL_plot ," RL" ,Color_RL,Style_RL+styleNoTitle); Plot(IIf(Parallellinesswitch,PLL_plot,-1e10)," PLL",Color_PLL,Style_PLL+styleNoTitle); Plot(IIf(Parallellinesswitch,PHL_plot,-1e10)," PHL",Color_PHL,Style_PHL+styleNoTitle); // Shading BEGIN=Min(xa,xc); TRS = IIf(x>BEGIN-1,SL,-1e10); TRR = IIf(x>BEGIN-1,RL,-1e10); trr = IIf(trr>0,trr,Null); yVal=IIf(trs > trr,trr,trs); yval = IIf(yval>0,yval,Null); GraphZOrder = 0; if(Version()>4.75){ PlotOHLC(0,trr,yval,0,"",Shadowcolor,styleCloud+styleNoLabel);} else { Plot(yVal,"",Backgroundcolor,styleArea+styleNoRescale+styleNoLabel); Plot(trr,"",Shadowcolor,styleArea+styleNoRescale+styleNoLabel); } ///////////End Ploting Part//////////// DefinedPatterns = AscT | DscT | ST | ET | RW | FW | UT | DT; Filter = BarIndex()==LastValue(BarIndex()) AND NOT GroupID()==253; Filter = Filter AND (AscT AND AscTs)| (DscT AND DscTs)| (ST AND STs)| (ET AND ETs)| (RW AND RWs)| (FW AND FWs)| (UT AND UTs)| (DT AND DTs)|(Range AND Ranges)| (SupSignals AND NonDefinedPatterns AND NOT DefinedPatterns)| (ResSignals AND NonDefinedPatterns AND NOT DefinedPatterns); // | PLLSignals | PHLSignals | Trade Variables Red=C<O; Green=C>O; Buy = FW | UT; //Buy=Buy1 & !Ref(Buy1,-1); Short = RW | DT; //Short = Short1 & !Ref(Short1,-1); Buy1=BarsSince(Buy); Short1=BarsSince(Short); BuyPrice=(round(ValueWhen(Buy,C)*10))/10; ShortPrice=(round(ValueWhen(Short,C)*10))/10; Buystop=(round((BuyPrice-(BuyPrice*0.5/100))*10))/10; Shortstop=(round((ShortPrice+(ShortPrice*0.5/100))*10))/10; Buystop1=((Cross(Buystop,C) OR Cross(Buystop,L)) AND since) ; Shortstop1=((Cross(H,Shortstop) OR Cross(C,Shortstop)) AND since); Sell1=(Buy1>0 AND ((CCI(14)<Ref(CCI(14),-1) AND Red) OR (x==xd & NOT AnZ)) AND since); Sell=Sell1 AND NOT Ref(Sell1,-1); Cover1=(Short1>0 AND ((CCI(14)>Ref(CCI(14),-1) AND Green) OR (x==xb & NOT AnZ)) AND since); Cover= Cover1 AND NOT Ref(Cover1,-1); SellPrice=(round(ValueWhen(Sell,C)*10))/10; CoverPrice=(round(ValueWhen(Cover,C)*10))/10; Buy11=Cum(Buy); Short11=Cum(Short); //Indicator if( Status("action") == actionIndicator ) ( Title = EncodeColor(colorLightBlue)+ "" +"\n"+EncodeColor(colorYellow)+ Name() + " - " + EncodeColor(colorYellow)+ Interval(2) + EncodeColor(colorWhite) + " - " + Date() +" - " +EncodeColor(colorYellow) + " TurnOver= Rs. "+EncodeColor(colorWhite)+ WriteVal((((V*C)/100000)),1.2)+" Lakhs - "+ "\n"+ WriteIf(LastValue(AscT),"Ascending Triangle - bullish formation that usually forms during an uptrend as a continuation pattern"+"","")+ WriteIf(LastValue(DscT),"Decending Triangle - bearish formation that usually forms during a downtrend as a continuation pattern."+"","")+ WriteIf(LastValue(ST),"Symmetrical Triangle - mark important trend reversals, they more often mark a continuation of the current trend - direction of the next major move can only be determined after a valid breakout."+"","")+ WriteIf(LastValue(ET),"Expanding Triangle - The expanding triangle is said to be a good indicator of a reversal pattern"+"","")+ WriteIf(LastValue(RW),"Rising Wedge - rising wedges definitely slope up and have a bearish bias"+"","")+ WriteIf(LastValue(FW),"Falling Wedge - falling wedges definitely slope down and have a bullish bias."+" ","")+ WriteIf(LastValue(UT),"Up Channel - Bullish Trend"+"","")+ WriteIf(LastValue(DT),"Down Channel - Bearish Trend"+"","")+ "\n"+ WriteIf(Sup_pricejustabove,EncodeColor(colorBrightGreen)+"Price just above Support", WriteIf(Sup_confirmed,EncodeColor(colorBrightGreen)+"Support Confirmed",EncodeColor(colorWhite)+""))+ WriteIf(Sup_break,EncodeColor(colorRed)+"Support Break"+"","")+"\n"+ WriteIf(Res_pricejustbelow,EncodeColor(colorRed)+"Price just below Resistance", WriteIf(Res_confirmed,EncodeColor(colorRed)+"Resistance Confirmed",EncodeColor(colorWhite)+""))+ WriteIf(Res_break,EncodeColor(colorBrightGreen)+"Resistance Break"+"","")+"\n"+ EncodeColor(colorBrightGreen) + WriteIf(BuyPrice, "BUY: "+(BuyPrice)+" ","")+ WriteIf(BuyStop, " - BUY SL: "+(BuyStop),"")+ WriteIf(SellPrice , " - BUY TP: "+(SellPrice)+" ","")+ "\n"+ EncodeColor(colorRed) + WriteIf(ShortPrice, "SHORT: "+(ShortPrice)+" ","")+ WriteIf(ShortStop, "- SHORT SL: "+(ShortStop)+" ","")+ WriteIf(CoverPrice, " - SHORT TP: "+(CoverPrice)+" ","")+"\n"+ "\n"+ WriteVal(Buy11)+ WriteVal(Short11)+WriteVal(LastValue(Buy))+ WriteVal(LastValue(Short))+ WriteIf(Range,"Range","Not defined")); //Shapes if(PlotP1P2){ PlotShapes(IIf(x==xa & NOT AnZ,P1Shape,shapeNone),Color_SL,0,SL,-13 ); PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),Color_SL,0,SL,-25 ); PlotShapes(IIf(x==xc & NOT AnZ,P1Shape,shapeNone),Color_RL,0,H,13 ); PlotShapes(IIf(Short,shapeDownArrow,shapeNone),Color_RL,0,H,-25 ); } PlotShapes(IIf(Buystop1,shapeCircle,shapeNone),Color_SL,0,SL,-13 ); PlotShapes(IIf(Cover,shapeUpTriangle,shapeNone),Color_RL,0,SL,-45 ); PlotShapes(IIf(Shortstop1,shapeCircle,shapeNone),Color_RL,0,H,-13 ); PlotShapes(IIf(Sell,shapeDownTriangle,shapeNone),Color_SL,0,H,-45 ); //money management lotSizeb = round((riskAmount/(BuyPrice-BuyStop))); lotSizes = round((riskAmount/(ShortStop-ShortPrice))); //Explorer AddColumn( IIf(Buy, 66, IIf(Short, 83,01 )), "GO", formatChar, colorWhite, bkcolor= IIf(Short,colorDarkRed,colorDarkGreen) ); AddColumn( IIf(Sell, 80, IIf(Cover, 80,01 )), "PR", formatChar, colorWhite, bkcolor= IIf(Cover ,colorDarkRed,colorDarkGreen) ); AddColumn( IIf(buystop1, 76, IIf(shortstop1, 76,01 )), "SL", formatChar, colorWhite, bkcolor= IIf(shortstop1 ,colorDarkRed,colorDarkGreen) ); AddColumn( IIf(Buy OR Buystop1 OR Sell, BuyPrice, IIf(Short OR shortstop1 OR Cover, ShortPrice,01 )), "ENTRY@", 1.2, colorWhite, bkcolor= IIf(Short OR Shortstop1 OR Cover,colorDarkRed,colorDarkGreen) ); AddColumn( IIf(Buy OR Buystop1 OR Sell, BuyStop, IIf(Short OR Shortstop1 OR Cover, ShortStop,01 )), "STPLS@", 1.2, colorWhite, bkcolor= IIf(Short OR Shortstop1 OR Cover,colorDarkRed,colorDarkGreen) ); AddColumn( IIf(Buy OR Buystop1 OR Sell, SellPrice, IIf(Short OR Shortstop1 OR Cover, CoverPrice,01 )), "PR@", 1.2, colorWhite, bkcolor= IIf(Short OR Shortstop1 OR Cover,colorDarkRed,colorDarkGreen) ); AddColumn( IIf(Buy OR Buystop1 OR Sell, Lotsizeb, IIf(Short OR Shortstop1 OR Cover, Lotsizes,01 )), "QTY", 1.0, colorWhite, bkcolor= IIf(Short OR Shortstop1 OR Cover,colorDarkRed,colorDarkGreen) ); AddTextColumn( WriteIf(Sup_pricejustabove,"Price just above", WriteIf(Sup_confirmed,"Confirmed", WriteIf(Sup_break,"Break",""))),"Support Line",1.2, IIf(Sup_pricejustabove OR sup_confirmed,colorGreen,colorRed)); AddTextColumn( WriteIf(Res_pricejustbelow,"Price just below", WriteIf(Res_confirmed,"Confirmed", WriteIf(Res_break,"Break",""))),"Resistance Line",1.2, IIf(Res_pricejustbelow OR Res_confirmed,colorRed,colorGreen)); patterncolor = IIf(AscT|FW|UT,colorGreen, IIf(DscT|RW|DT,colorRed, IIf(ST|ET|Range,colorBlue,colorBlack))); AddTextColumn(PatternText,"Pattern",0,patterncolor ); AddTextColumn(FullName(),"Full name"); AddTextColumn( WriteIf(PLL_pricejustabove,"price just above", WriteIf(PLL_confirmed,"confirmed", WriteIf(PLL_break,"break",""))),"Parallel support line"); AddTextColumn( WriteIf(PHL_pricejustbelow,"price just below", WriteIf(PHL_confirmed,"confirmed", WriteIf(PHL_break,"break",""))),"Parallel resistance line"); //Alerts AlertIf( Buy, "SOUND C:\\Windows\\Media\\Windows XP Startup.wav", "Buy",2); AlertIf( Short, "SOUND C:\\Windows\\Media\\Windows XP Startup.wav", "Short", 2 ); AlertIf( BuyStop1, "SOUND C:\\Windows\\Media\\Ringin.wav", "BuyStop Hit", 2 ); AlertIf( Sell, "SOUND C:\\Windows\\Media\\Ringin.wav", "Buy Take Profit", 2 ); AlertIf( ShortStop1, "SOUND C:\\Windows\\Media\\Ringin.wav", "Short Stop Hit", 2 ); AlertIf( Cover , "SOUND C:\\Windows\\Media\\Ringin.wav", "Short Take Profit", 2 ); /* Export intraday AND EOD data to TXT files In the first line insert the directory you want to save them to, make sure the directory exists Select the timeframe period you want to save as using the AA "Settings" */ if (IsEmpty(StaticVarGet("SendSignal"+Name()))) { StaticVarSet("SendSignal"+Name(), 1); } if ((StaticVarGet("SendSignal"+Name()) == 1) & LastValue( Buy ) ) { fh = fopen("C:\\BTT_Exe\\config\\order"+".SAV", "awr"); if( fh) { fputs("NSECM|Buy|CLI|VYV118|"+Name()+"|"+BuyPrice+"|"+Lotsizeb+"|"+"SL|"+(round((BuyPrice-(BuyPrice*0.02/100))*10))/10+"|"+"-|-|NL|Margin|08067|N|DAY|Long at|-|-|-|-|-|"+"\n", fh); fputs("NSECM|Sell|CLI|VYV118|"+Name()+"|"+BuyStop+"|"+Lotsizeb+"|"+"SL|"+(round((BuyStop+(BuyStop*0.03/100))*10))/10+"|"+"-|-|NL|Margin|08067|N|DAY|BuyStop|-|-|-|-|-|"+"\n", fh); fputs(""+"\n", fh); StaticVarSet("SendSignal"+Name() , 0); fclose( fh ); } } if (IsEmpty(StaticVarGet("SendSignal1"+Name()))) { StaticVarSet("SendSignal1"+Name(), 1); } if ((StaticVarGet("SendSignal1"+Name()) == 1) & LastValue( Short ) ) { fh = fopen("C:\\BTT_Exe\\config\\order"+".SAV", "awr"); if( fh) { fputs("NSECM|Short Sell|CLI|VYV118|"+Name()+"|"+ShortPrice+"|"+Lotsizes+"|"+"SL|"+(round((ShortPrice+(ShortPrice*0.02/100))*10))/10+"|"+"-|-|NL|Margin|08067|N|DAY|Short at|-|-|-|-|-|"+"\n", fh); fputs("NSECM|Buy to Cover|CLI|VYV118|"+Name()+"|"+shortStop+"|"+Lotsizes+"|"+"SL|"+(round((Shortstop-(ShortStop*0.03/100))*10))/10+"|"+"-|-|NL|Margin|08067|N|DAY|ShortStop|-|-|-|-|-|"+"\n", fh); fputs(""+"\n", fh); StaticVarSet("SendSignal1"+Name() , 0); fclose( fh ); } } if (IsEmpty(StaticVarGet("SendSignal2"+Name()))) { StaticVarSet("SendSignal2"+Name(), 1); } if ((StaticVarGet("SendSignal2"+Name()) == 1) & LastValue (Buy11) & LastValue( Buy ) ) { fh = fopen("C:\\BTT_Exe\\config\\order"+".SAV", "awr"); if( fh) { fputs("NSECM|Buy|CLI|VYV118|"+Name()+"|"+BuyPrice+"|"+Lotsizeb+"|"+"SL|"+(round((BuyPrice-(BuyPrice*0.02/100))*10))/10+"|"+"-|-|NL|Margin|08067|N|DAY|Long at|-|-|-|-|-|"+"\n", fh); fputs("NSECM|Sell|CLI|VYV118|"+Name()+"|"+BuyStop+"|"+Lotsizeb+"|"+"SL|"+(round((BuyStop+(BuyStop*0.03/100))*10))/10+"|"+"-|-|NL|Margin|08067|N|DAY|BuyStop|-|-|-|-|-|"+"\n", fh); fputs(""+"\n", fh); StaticVarSet("SendSignal2"+Name() , 0); fclose( fh ); } } if (IsEmpty(StaticVarGet("SendSignal3"+Name()))) { StaticVarSet("SendSignal3"+Name(), 1); } if ((StaticVarGet("SendSignal3"+Name()) == 1) & LastValue(Short11) & LastValue( Short ) ) { fh = fopen("C:\\BTT_Exe\\config\\order"+".SAV", "awr"); if( fh) { fputs("NSECM|Short Sell|CLI|VYV118|"+Name()+"|"+ShortPrice+"|"+Lotsizes+"|"+"SL|"+(round((ShortPrice+(ShortPrice*0.02/100))*10))/10+"|"+"-|-|NL|Margin|08067|N|DAY|Short at|-|-|-|-|-|"+"\n", fh); fputs("NSECM|Buy to Cover|CLI|VYV118|"+Name()+"|"+shortStop+"|"+Lotsizes+"|"+"SL|"+(round((Shortstop-(ShortStop*0.03/100))*10))/10+"|"+"-|-|NL|Margin|08067|N|DAY|ShortStop|-|-|-|-|-|"+"\n", fh); fputs(""+"\n", fh); StaticVarSet("SendSignal3"+Name() , 0); fclose( fh ); } } if (IsEmpty(StaticVarGet("SendSignal4"+Name()))) { StaticVarSet("SendSignal4"+Name(), 1); } if ((StaticVarGet("SendSignal4"+Name()) == 1) & LastValue(Short11) & LastValue( Buy ) ) { fh = fopen("C:\\BTT_Exe\\config\\order"+".SAV", "awr"); if( fh) { fputs("NSECM|Buy|CLI|VYV118|"+Name()+"|"+BuyPrice+"|"+Lotsizeb+"|"+"SL|"+(round((BuyPrice-(BuyPrice*0.02/100))*10))/10+"|"+"-|-|NL|Margin|08067|N|DAY|Long at|-|-|-|-|-|"+"\n", fh); fputs("NSECM|Sell|CLI|VYV118|"+Name()+"|"+BuyStop+"|"+Lotsizeb+"|"+"SL|"+(round((BuyStop+(BuyStop*0.03/100))*10))/10+"|"+"-|-|NL|Margin|08067|N|DAY|BuyStop|-|-|-|-|-|"+"\n", fh); fputs(""+"\n", fh); StaticVarSet("SendSignal4"+Name() , 0); fclose( fh ); } } if (IsEmpty(StaticVarGet("SendSignal5"+Name()))) { StaticVarSet("SendSignal5"+Name(), 1); } if ((StaticVarGet("SendSignal5"+Name()) == 1) & LastValue(Buy11) & LastValue( Short ) ) { fh = fopen("C:\\BTT_Exe\\config\\order"+".SAV", "awr"); if( fh) { fputs("NSECM|Short Sell|CLI|VYV118|"+Name()+"|"+ShortPrice+"|"+Lotsizes+"|"+"SL|"+(round((ShortPrice+(ShortPrice*0.02/100))*10))/10+"|"+"-|-|NL|Margin|08067|N|DAY|Short at|-|-|-|-|-|"+"\n", fh); fputs("NSECM|Buy to Cover|CLI|VYV118|"+Name()+"|"+shortStop+"|"+Lotsizes+"|"+"SL|"+(round((Shortstop-(ShortStop*0.03/100))*10))/10+"|"+"-|-|NL|Margin|08067|N|DAY|ShortStop|-|-|-|-|-|"+"\n", fh); fputs(""+"\n", fh); StaticVarSet("SendSignal5"+Name() , 0); fclose( fh ); } } //Filters Filter= Buy OR Short OR Buystop1 OR Shortstop1 OR Sell OR Cover;
Sign up here with your email
ConversionConversion EmoticonEmoticon