Simple Coding Help - No Promise.

I don't know about portability issue as I have not worked with other trading s/w. and I am also aware that functions like AMA maybe using for loop internally, but this is expected to be better optimized by ami.

And I know the value of 'for' as a programming construct. I was 20+ years in IT and have lead teams and designed for complex s/w like medical ultrasound m/c s/w, Smart card systems and the like.

array programming maybe diff to understand, that is why I said that to write better programmes that thinking needs to come in and where array programming option is available, I will still continue to avoid loops
Ahhha, another software veteran.... I too have been in IT industry for 20 odd years and all of my best projects have been into deep finance...

Am still a relative newbie in trading but I have explored many different charting and trading terminals. AmiBroker is very unique product
 

pratapvb

Well-Known Member
A Help is Required..... Can the position of New candle can be shifted from left last to middle of the screen
tool->preferences->charting->blank bars in right margin

set above value.....I use a value of 30
 

pratapvb

Well-Known Member
Alright. So I tried everything that I thought might make it work but it didn't. Even re-written the whole code.

Code:
_SECTION_BEGIN("Earth");
VarT1	= ( High + Low + Close *2 ) / 4;
BT1		= (EMA((VarT1 - LLV(VarT1,15))/(HHV(Low,15) - LLV(VarT1, 15)), 2)) * 38;
BotT1	= (((-1)) * (EMA( (VarT1- LLV(VarT1,15) ) / (HHV(Low,15)-LLV(VarT1,15)), 2) + 0.01)) * 38;
Var2T1	= ((Close-LLV(Low,10))/(HHV(High,10)-LLV(Low,10))) * 100;
Var3T1	= EMA(Var2T1, 10);
Var4T1	= EMA(Var3T1, 10);
Var5T1	= 3 * Var3T1 - 2 * Var4T1;
Var6T1	= EMA(Var5T1, 5);
BridgeT1	= EMA(Var6T1, 1);

myc	= IIf(BridgeT1 > Ref(BridgeT1,-1), colorBlue, colorRed);
Plot(12, "ribbon", myc, styleOwnScale | styleArea|styleNoLabel, -10, 150);
_SECTION_END();

_SECTION_BEGIN("10min Earth");
tf	= in1Minute*10;
TimeFrameSet(tf);

VarT2	= ( High + Low + Close * 2 ) / 4;
BT2		= (EMA((VarT2 - LLV(VarT2,15))/(HHV(Low, 15) - LLV(VarT2, 15)), 2)) * 38;
BotT2	= (((-1)) * (EMA( (VarT2- LLV(VarT2,15) ) / (HHV(Low, 15)-LLV(VarT2, 15)), 2) + 0.01)) * 38;
Var2T2	= ((Close-LLV(Low, 10))/(HHV(High, 10)-LLV(Low, 10))) * 100;
Var3T2	= EMA(Var2T2, 10);
Var4T2	= EMA(Var3T2, 10);
Var5T2	= 3 * Var3T2 - 2 * Var4T2;
Var6T2	= EMA(Var5T2, 5);
BridgeT2	= EMA(Var6T2, 1);
BridgeT2e	= TimeFrameExpand(BridgeT2, tf, expandLast);

myc2	= IIf(BridgeT2e > Ref(BridgeT2e, -2), colorBlue, colorRed);
Plot(6, "ribbon", myc2, styleOwnScale | styleArea|styleNoLabel, 0.1, 100);
TimeFrameRestore();
_SECTION_END();
Then I changed this Ref(BridgeT2e, -1) into this Ref(BridgeT2e, -2) and TADA!!!!.....

Check if this is now working fine.
in s/w engg this would be said to patch the code to make it work...but from a structure point of view it is not good. (P.S. my intention is only to make the code better, no offence)

This code is not timeframe independent as in if you make TFs as param (instead of hardcoding) then for 15min you will need 3 and for 60, 20 etc

better is

BridgeT2 = EMA(Var6T2, 1);
myc2 = IIf(BridgeT2 > Ref(BridgeT2, -1), colorBlue, colorRed);
TimeFrameRestore() ;

myc2e = TimeFrameExpand(myc2, tf, expandLast);

and use myc2e in the plot
 

Nehal_s143

Well-Known Member
Alright. So I tried everything that I thought might make it work but it didn't. Even re-written the whole code.


Then I changed this Ref(BridgeT2e, -1) into this Ref(BridgeT2e, -2) and TADA!!!!.....

Check if this is now working fine.
Thank you very much sir, I tried many ways but it was not working at all, always error in plotting ribbon color. I got frustrated trying and trying.

Sir Its working now fine :).

Thank you Abhi Sir & Pratab sir for all the efforts :)
 
I am trying to write my own code with buy and sell signal..

But my system can create sequental BUY or SELL signals..But i want only one buy signal after a sell signal.. and vise versa..

How can i skip a buy signal if the previous signal is BUY..?

for instance; the code line that i request must be in this manner..

IF the previous signal is BUY SKİP this BUY signal..
IF the previous signal is SELL SKİP this SELL signal..

How can i add these code lines?
 
I thought you wanted Risk 1% and Profit 1% so I coded it that way. Anyways, you want to be able to decide the position size? Give me an example where you have buy price, total number of shares, target price, SL price and I'll do it.
Hi,

Thanks for the interest shown. Sorry for the late reply.

Ihv included the position size, sl, trigger price and tgt as add column in the afl itself.

I am also attaching a chart showing the calculations for your reference.
 

Attachments

i wanted to be able to back test some specific stocks, they can be chosen depending on their industry type, price range or some random stocks that i want. Now i am aware of the fact that ami provides the facility so that we can filter the stocks on those basis but the problem is my stocks are not grouped. Is their a quick fix to it or will i be forced to change each scrip information manually to be able to do the proper testing.
w a t c h l i s t
 

Similar threads