Simple Coding Help - No Promise.

trash

Well-Known Member
Plot(OBV(),"obv",colorWhite,styleThick); O_B_V = 0; // replace this line with next line to get exact OBV figures //O_B_V[0] = V[0]; for (i = 1; i < BarCount; i++) { if(C > C[i-1]) O_B_V = O_B_V[i-1] + V; else if(C < C[i-1]) O_B_V = O_B_V[i-1] - V; else O_B_V = O_B_V[i-1]; } Plot (O_B_V,"OBV2",colorGreen, styleThick);
It is obvious once again that you do not have slightest clue on how to apply AFL properly.
Contrary to that more clue on stealing AmiBroker.
What a tool.
 

john302928

Well-Known Member
Hi
I run the below code by setting the backtesting time frame to Monthly as shown in the image . but its not producing BEPL in the result on 8 jan 2021. Could anyone please let me know why. I am trying to find out red candle stocks. the below code supposed to produce BEPL in the result since BEPL is red candle today. But its not producing it. I would like to know why. Thanks in advance

1610113043257.png

TimeFrameSet( inDaily ); // switch now to daily

Dailyredcandle = Close < Open;

TimeFrameRestore(); // restore time frame to original


Filter = Dailyredcandle;
 
I am new to AFL coding. Experts here kindly help me out with the following which despite spending hours I could not make it work.

So following is my requirement:

I want to find out the highest price reached until the end of day AFTER buy signal is generated.

After market hours, I want to run the explorer and analyze those stocks.

However, the highest price being displayed is incorrect. See screenshot. Kindly help !!!!

CODE:

Code:
Buy = Cross( MACD(), Signal() );
Short = Cross( Signal(), MACD() );

Cover = Sell = TimeNum()>151500 OR 0;

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

Filter = Buy OR Short;

AddColumn(IIf(Buy,HighestSince(Buy, High),Null),"Highest",1.2);

AddColumn(IIf(Short,LowestSince(Short, Low),Null),"Lowest",1.2);
screenshot.png
 

Romeo1998

Well-Known Member
I am new to AFL coding. Experts here kindly help me out with the following which despite spending hours I could not make it work.

So following is my requirement:

I want to find out the highest price reached until the end of day AFTER buy signal is generated.

After market hours, I want to run the explorer and analyze those stocks.

However, the highest price being displayed is incorrect. See screenshot. Kindly help !!!!

CODE:

Code:
Buy = Cross( MACD(), Signal() );
Short = Cross( Signal(), MACD() );

Cover = Sell = TimeNum()>151500 OR 0;

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

Filter = Buy OR Short;

AddColumn(IIf(Buy,HighestSince(Buy, High),Null),"Highest",1.2);

AddColumn(IIf(Short,LowestSince(Short, Low),Null),"Lowest",1.2);
View attachment 45225
good luck :)
Code:
AddColumn(HighestSince(sell, High),"Highest",1.2);
AddColumn(LowestSince(cover, Low),"Lowest",1.2);
 

john302928

Well-Known Member
Hi
I run the below code by setting the backtesting time frame to Monthly as shown in the image . but its not producing BEPL in the result on 8 jan 2021. Could anyone please let me know why. I am trying to find out red candle stocks. the below code supposed to produce BEPL in the result since BEPL is red candle today. But its not producing it. I would like to know why. Thanks in advance

View attachment 45224
TimeFrameSet( inDaily ); // switch now to daily

Dailyredcandle = Close < Open;

TimeFrameRestore(); // restore time frame to original


Filter = Dailyredcandle;
@Romeo1998 @timepass or anyone please help me on this query. thanks
 

john302928

Well-Known Member
if u r exploring the current day for a red day, then use Daily in Periodicity and in Range "1 recent day". good luck :)
Code:
Filter = Close < Open;
AddColumn(c,"Close");
No, I have to explore in monthly time frame so i set the backtesting to Monthly. But some of the conditions need to be satisfied in daily time frame.
So when i checked by setting the the backtester periodicity to Monthly view and explored this red candle in daily time frame its not producing correct results.
 

chintan786

Well-Known Member
@Romeo1998 And @Happy_Singh JI, need your help for moneymanagment purpose in going trade.
After buy wants to book profit with 50% position after +100 points. and Max position size is 50, Min. position size is 25. Max open position 2 lots.
can you guys kindly look into it.

thanks in advance
 

Similar threads

Zerodha – Open Paperless Account

Open online account with Zerodha. Free delivery trading and Max Rs 20 for Intraday, F&O, Currency and Commodity Trading. Intraday High leverage with MIS, CO and BO.

Name:Phone:
Email:City:
State:
Are you a day trader?