Simple Coding Help - No Promise.

ethan hunt

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.
 
Last edited:

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
 
Last edited:
Hi, need some help.

In Amibroker, to get the standard MACD we have the built in indicator. But it does not show the values of the histogram.

How can we get a value for the histogram?

I checked in properties, no way from there.
 

mastermind007

Well-Known Member
Hi, need some help.

In Amibroker, to get the standard MACD we have the built in indicator. But it does not show the values of the histogram.

How can we get a value for the histogram?

I checked in properties, no way from there.
Very odd, I found following in my Standard Indicator folder and if I don't think I added it myself.

Code:
_SECTION_BEGIN("MACD");
r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );
Plot( ml = MACD(r1, r2), StrFormat(_SECTION_NAME()+"(%g,%g)", r1, r2), ParamColor("MACD color", colorRed ), ParamStyle("MACD style") );
Plot( sl = Signal(r1,r2,r3), "Signal" + _PARAM_VALUES(), ParamColor("Signal color", colorBlue ), ParamStyle("Signal style") );
Plot( ml-sl, "MACD Histogram", ParamColor("Histogram color", colorBlack ), styleNoTitle | ParamStyle("Histogram style", styleHistogram | styleNoLabel, maskHistogram ) );
_SECTION_END();
 

XRAY27

Well-Known Member
hi
following is the code of Heiken Ashi Smoothed... i want just HACLOSE value without displaying heiken ashi candle
_SECTION_BEGIN("Heiken Ashi Smoothed");
SetChartBkGradientFill( ParamColor("BgTop", colorBlack),ParamColor("BgBottom", colorBlack),ParamColor("Titleblock",colorLightGrey ));
SetChartOptions(0,chartShowArrows|chartShowDates);
GraphXSpace=5;
p=Param("Period",6,2,30,1);
Om=MA(O,p);
hm=MA(H,p);
lm=MA(L,p);
Cm=MA(C,p);
HACLOSE=(Om+Hm+Lm+Cm)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( Hm, Max( HaClose, HaOpen ) );
HaLow = Min( Lm, Min( HaClose, HaOpen ) );
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "" + Name(), colorWhite, styleCandle | styleNoLabel );
_SECTION_END();
 
Last edited:

mastermind007

Well-Known Member
XRAY27

It is already there for you. Nothing extra is needed. In fact, you can even comment out last 4 lines highlighted in red.

hi
following is the code of Heiken Ashi Smoothed... i want just HACLOSE value without displaying heiken ashi candle
_SECTION_BEGIN("Heiken Ashi Smoothed");
SetChartBkGradientFill( ParamColor("BgTop", colorBlack),ParamColor("BgBottom", colorBlack),ParamColor("Titleblock",colorLightGrey ));
SetChartOptions(0,chartShowArrows|chartShowDates);
GraphXSpace=5;
p=Param("Period",6,2,30,1);
Om=MA(O,p);
hm=MA(H,p);
lm=MA(L,p);
Cm=MA(C,p);
HACLOSE=(Om+Hm+Lm+Cm)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( Hm, Max( HaClose, HaOpen ) );
HaLow = Min( Lm, Min( HaClose, HaOpen ) );
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "" + Name(), colorWhite, styleCandle | styleNoLabel );

_SECTION_END();
 

XRAY27

Well-Known Member

ethan hunt

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.
bumpwa ...
 

Similar threads