Simple Coding Help - No Promise.

hey i have a statergy can you plz help me in making its afl
the strategy is
generate a buy signal in a 10 min chart if the high of the candle ending at 10 am is breached ..
else generate a sell signal if the low of that 10 am candle is breached
book profit at +6% (ex: if buy price is 100 rs then profit bookin price =100x1.06)
thanx in advance :) :)
 
hey i have a statergy can you plz help me in making its afl
the strategy is
generate a buy signal in a 10 min chart if the high of the candle ending at 10 am is breached ..
else generate a sell signal if the low of that 10 am candle is breached
book profit at +6% (ex: if buy price is 100 rs then profit bookin price =100x1.06)
thanx in advance :) :)
How is 10:00 AM Candle shown on your Amibroker? Is it showing time as 10:00:00 or as 10:09:59 or as 09:59:59?
 
I require pivot point of particular date and related system example as below

1) I need 10-06-2016 day high , day low, day close.

2) If current 5 minutes candle close above 10-06-2015 pivot then buy and reversal for sell..

3) Don't need bars back bcas every day i have to increase bars value by 1...
 
Last edited:
I require pivot point of particular date and related system example as below

1) I need 10-06-2016 day high , day low, day close.

2) If current 5 minutes candle close above 10-06-2015 pivot then buy and reversal for sell..

3) Don't need bars back bcas every day i have to increase bars value by 1...
Following line of AFL will do what you want without having to increase the bar values by one everyday
Code:
desiredHigh = ValueWhen(DateNum() == 20160610, High);
Buy = Cross (Close, desiredHigh); 
Sell = Cross(desiredHigh, Close);
Now that the coding problem is solved, Everyone in the trading world needs and would very much love to know the high on 10 06 2016 (as of 22 06 2015) :clap:; :clap:; :clap:; :clap:;

In fact, people will be extremely delirious if they can somehow figure out at 9:15 AM IST, what the high is going to be for the upcoming session.
 
Following line of AFL will do what you want without having to increase the bar values by one everyday
Code:
desiredHigh = ValueWhen(DateNum() == 20160610, High);
Buy = Cross (Close, desiredHigh); 
Sell = Cross(desiredHigh, Close);
Now that the coding problem is solved, Everyone in the trading world needs and would very much love to know the high on 10 06 2016 (as of 22 06 2015) :clap:; :clap:; :clap:; :clap:;

In fact, people will be extremely delirious if they can somehow figure out at 9:15 AM IST, what the high is going to be for the upcoming session.
Thank you and the date is 10-06-2015 ...
syntax for datenum as datenum()==yyyymmdd? am i right..

how can i vary the date as "Param" syntax..means dynamic date high like that....
 
Last edited:
Following line of AFL will do what you want without having to increase the bar values by one everyday
Code:
desiredHigh = ValueWhen(DateNum() == 20160610, High);
Buy = Cross (Close, desiredHigh); 
Sell = Cross(desiredHigh, Close);
Now that the coding problem is solved, Everyone in the trading world needs and would very much love to know the high on 10 06 2016 (as of 22 06 2015) :clap:; :clap:; :clap:; :clap:;

In fact, people will be extremely delirious if they can somehow figure out at 9:15 AM IST, what the high is going to be for the upcoming session.

the following system not showing anything on chart either arrows or line ...please correct it....

PHP:
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_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", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

desiredHigh = ValueWhen(DateNum() == 20150605, High);
Buy1 = Cross (Close, desiredHigh); 
Sell1= Cross(desiredHigh, Close);
Buy=ExRem(Buy1,Sell1);
Sell=ExRem(Sell1,Buy1);
Short=Sell;
Cover=Buy;
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(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);                      
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
Plot(desiredHigh, "desiredHigh", colorRed, styleLine, Null, Null, 10 );

_SECTION_END();
 
Last edited:
the following system not showing anything on chart either arrows or line ...please correct it....

PHP:
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_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", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

desiredHigh = ValueWhen(DateNum() == 20150605, High);
Buy1 = Cross (Close, desiredHigh); 
Sell1= Cross(desiredHigh, Close);
Buy=ExRem(Buy1,Sell1);
Sell=ExRem(Sell1,Buy1);
Short=Sell;
Cover=Buy;
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(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);                      
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
Plot(desiredHigh, "desiredHigh", colorRed, styleLine, Null, Null, 10 );

_SECTION_END();
Sorry, in case of Datenum(), value must be reduced by 19000000.

So, 20150605 - 19000000 = 1150605

Code:
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_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", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

[B][COLOR="Red"]desiredHigh = ValueWhen(DateNum() == 1150605, High);[/COLOR][/B]
Buy1 = Cross (Close, desiredHigh); 
Sell1= Cross(desiredHigh, Close);
Buy=ExRem(Buy1,Sell1);
Sell=ExRem(Sell1,Buy1);
Short=Sell;
Cover=Buy;
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(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);                      
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
Plot(desiredHigh, "desiredHigh", colorRed, styleLine, Null, Null, 10 );

_SECTION_END();
 
Last edited:

Similar threads