Simple Coding Help - No Promise.

ethan hunt

Well-Known Member
Suppose:

Buy_Valid = ExRem(Buy_Valid,Sell_Valid);
Sell_Valid = ExRem(Sell_Valid,Buy_Valid);
Buy=Buy_Valid;
Sell=Sell_Valid OR (code required: SL or TGT or TSL reached);
Short=Sell_Valid;
Cover=Buy_Valid OR (code required: SL or TGT or TSL reached);

need code for condition stated in blue above, for scan.

thanks
bumpwa ...
 

mastermind007

Well-Known Member

XRAY27

Well-Known Member
Why are you creating separate thread for that?

To get the value where you want it, simply append it to Title
i could not add the image here... thats why created another thread...
tell me in detail how to get haclose in normal candle chart.."append Title... iam not getting you sir
 
Last edited:

mastermind007

Well-Known Member
i could not add the image here... thats why created another thread...
tell me in detail how to get haclose in normal candle chart.."append Title... iam not getting you sir
Post your complete AFL here within the CODE tags. I need to see the Title tag before I can tell you how to get HACLOSE in it.
 

mastermind007

Well-Known Member
Is the following code correct:

ApplyStop(0,2,25); // for SL Stop Loss of 25 points
ApplyStop(1,2,50); // for TGT Profit Stop of 50 points
ApplyStop(2,2,25);// for TSL Trailing Profit Stop Loss of 25 points


All trades to be executed as soon as the respective SL/TGT/TSL levels are reached when calculated from entry

Backtesting does shows buy/sell/short/cover based on above conditions.

Auto SCAN does not show buy/sell/short/cover based on above conditions which is required to enter trades in real time as & when auto SCAN throws up results, for instance every 5 min.
Apply Stops you mentioned seem correct, although as far as I know, you cannot use both SL and TSL together. But, I could easily be wrong on this one. I don't use these too often.

ApplyStop function has nothing to do with Scanning and of no use during scanning.
 
_SECTION_BEGIN("MACD"); SetChartBkColor( ParamColor("background",colorBlack) ); A1=EMA(C,12)-EMA(C,26);
BBtop=BBandTop(A1,10,1);
BBbot=BBandBot(A1,10,1);
Color=IIf(a1<0 AND a1>Ref(a1,-1), colorLime,IIf(a1>0 AND a1>Ref(a1,-1),colorBrightGreen,IIf(a1>0 AND a1<Ref(a1,-1),colorCustom12,colorRed))); Plot(a1,"MACD",color,styleDots+styleLine);
Plot(BBtop,"BBtop",colorWhite,styleDashed); Plot(BBbot,"BBbot",colorWhite,styleDashed);
Plot(0,"",31,1);
_SECTION_END();




condition is sell when below the band and is in red colour only pink no trade and buy arrow when is green and above the band
Can some one add buy sell arrow when their is buy sell signal and voice alert
email alert to gmail for this afl when the condition meets
Thanks
 
Last edited:
Hello,

How to plot the shapes for the actual trades as per backtest report?
I have used the following AFL for plotting but some trades were actually not showed in backtest report.

shapebuy = Buy * shapeUpArrow + Sell * shapeDownArrow;
shapeshort = Short * shapeDownArrow + Cover * shapeUpArrow;
PlotShapes( shapebuy, IIf( Buy, colorYellow, colorBlue ), 0, IIf( Buy, Low, High ) );
PlotShapes( shapeshort, IIf( Short, colorRed, colorGreen ), 0, IIf( Short, High, Low ) );
GraphXSpace = 5;

Thank you!!!
 

Nehal_s143

Well-Known Member
use following, if you dont have cover/exit short mark // for short and cover

Buy=ExRem(Buy,Sell);
Short=ExRem(Short,Cover);
Sell=ExRem(Sell,Buy);
Cover=ExRem(Cover,Short);

PlotShapes(Buy*shapeUpArrow,colorBlue,0,L,-45);
PlotShapes(Sell*shapeHollowDownArrow,colorPink,0,L,-45);
PlotShapes(Short*shapeDownArrow,colorRed,0,H,-45);
PlotShapes(Cover*shapeHollowUpArrow,colorSkyblue,0,H,-45);


Hello,

How to plot the shapes for the actual trades as per backtest report?
I have used the following AFL for plotting but some trades were actually not showed in backtest report.

shapebuy = Buy * shapeUpArrow + Sell * shapeDownArrow;
shapeshort = Short * shapeDownArrow + Cover * shapeUpArrow;
PlotShapes( shapebuy, IIf( Buy, colorYellow, colorBlue ), 0, IIf( Buy, Low, High ) );
PlotShapes( shapeshort, IIf( Short, colorRed, colorGreen ), 0, IIf( Short, High, Low ) );
GraphXSpace = 5;

Thank you!!!
 

mastermind007

Well-Known Member
use following, if you dont have cover/exit short mark // for short and cover

Buy=ExRem(Buy,Sell);
Short=ExRem(Short,Cover);
Sell=ExRem(Sell,Buy);
Cover=ExRem(Cover,Short);

PlotShapes(Buy*shapeUpArrow,colorBlue,0,L,-45);
PlotShapes(Sell*shapeHollowDownArrow,colorPink,0,L,-45);
PlotShapes(Short*shapeDownArrow,colorRed,0,H,-45);
PlotShapes(Cover*shapeHollowUpArrow,colorSkyblue,0,H,-45);


Hello,

How to plot the shapes for the actual trades as per backtest report?
I have used the following AFL for plotting but some trades were actually not showed in backtest report.

shapebuy = Buy * shapeUpArrow + Sell * shapeDownArrow;
shapeshort = Short * shapeDownArrow + Cover * shapeUpArrow;
PlotShapes( shapebuy, IIf( Buy, colorYellow, colorBlue ), 0, IIf( Buy, Low, High ) );
PlotShapes( shapeshort, IIf( Short, colorRed, colorGreen ), 0, IIf( Short, High, Low ) );
GraphXSpace = 5;
Nehal, jacklcl,

Code of Nehal will not alone help track the problem as it will not allow comparison.

In addition to this, you have to Right click on a trade in back test report and select from few options to "Show Trades ....".

Do this for a very small time range or else your chart will have too many arrows.
 
Last edited:

Similar threads