Gap up stocks/intraday

hiii
i want afl code for this strategy

gap up= open>previous day high short sell 3 top stocks at 9.25am with 2% stoploss
exit at 3.15pm

Hi @vaibhav980,

Welcome to the AB forum, where people are free to ask whaterver they like, but don't always get what they want, let alone like what they get.

In reference to your request: "I want ...", without any indication of effort on your part, suggests that you want someone to figure this out for you free of charge!

For this community to help you, please help us, by providing some evidence that you've actually had a go at this yourself, in the form of code/ charts, to demonstrate that you have some appreciation of what's involved in achieving it.

Please read the following:

2 Likes

I don't how to code or I am not in IT background but I can help it with this backtest providing backtest report

@vaibhav980, there are rewards for effort, and anyone who can make a quick buck in trading, is either a genius, has the "knack" for it, or is doing something unusual. The rest of us keep trying to find an "edge".

Also, there are a lot of people on this forum who don't have a background in IT or programming, we even have physicians, and some of us have spent a lot of time, painfully, trying to understand how things work. Overall, people are prepared to study and figure things out for themselves, and when they can't, they're prepared to put some effort into providing the sort of info outlined in "How to ask a good question".

If you're in a desperate hurry to have the code, then hire someone professionally, there are plenty of people who'd be prepared to help you, for a price.

Or, hire a coach, someone who can help you to learn about trading, IT, programming, AmiBroker, etc. There are also plenty of people who can do this for you.

I'm not sure what you mean by "but I can help it with this backtest providing backtest report".

3 Likes

//gap up //
ShortPrice= O> Ref(H,-1) TimeNum()>92500;
CoverPrice=TimeNum()>151500 ;

this above code is showing error
i readied some of logic code online and arrive to this code

please check it according to this creteria ?(gap up= open>previous day high short sell 3 top stocks at 9.25am with 2% stoploss
exit at 3.15pm)
image

thank you

You see, you miss absolute basics. In this case:

ShortPrice= O > Ref(H,-1) TimeNum()>92500; // INCORRECT

you miss the semicolon at the end of statement or (more likely) AND logical operator if you want to combine two conditions, as this is what you appear to want, see http://www.amibroker.com/guide/a_language.html

Also you are incorrectly using ShortPrice variable. It is for setting the price, not to pass (boolean) trade entry condition, see http://www.amibroker.com/guide/h_backtest.html

Correct code could look like this:

Short = O > Ref(H,-1) AND TimeNum() > 92500; // added missing "AND" operator
ShortPrice = Open; // to trade using open price 

The thing is that you need to LEARN some basics first. You will find the information here How do I learn AFL?

Especially for beginners there are plenty of videos with great "hands-on" exercises for you to follow: https://www.youtube.com/results?search_query=lets+learn+amibroker

2 Likes

image

Short = O > Ref(H,-1) AND TimeNum() > 92500;
ShortPrice = Open;
Cover= TimeNum() > 151500;

this above code is for this condition right intraday time frame
gap up= open>previous day high, short sell 3 top stocks at 9.25am with 2% stoploss
exit at 3.15pm

Hey man @Tomasz your code worked for me but during back test it was not placing trade on particular time which is mention in code (9.25 am) should be shortsell after that time no trade should be place
and covering the position at 3.15pm but during backtest i was carried trade forward
i want only 3 share should be shortsell

can provide me full code

Moderator comment: Moved from duplicate thread. DO NOT post duplicates. BTW: are you registered user?

hii

i have write this code for my strategy
gap up= open>previous day high short sell 3 top stocks at 9.25am with 2% stoploss
exit at 3.15pm
please help me to make it correct

image

OMG, after posting a long answer I find that you have posted the exact same question last week. So I am removing my answer.

Please don't create duplicate threads!

1 Like