I am running my code in backtest within timeframeset(timeT) timeframrestore(). The periodicity is 5 seconds and timeT is 60 seconds. entry and exit happens in timeT. After running backtest I view the result in timeT interval chart.
The Date and Ex.date in reult list is showing time off by few minutes. I am able o visualize the trade in the chart perfectly.
Do i need to expand arrays short, cover, buy, sell etc for this to show up correctly in result list in AA?
Please DO READ at least "Orange boxes" (IMPORTANT messages) in the documentation covering multi time frame functions:
https://www.amibroker.com/guide/h_timeframe.html
Secondly your post does not provide all necessary details to give you an answer - it is missing THE FORMULA ! Please follow this advice: How to ask a good question
//Running this is backtest in periodicity 5 seconds
if(status("action")==5 ||status("action")==6)
{
TimeframeSet(60);
short=<something>
cover=<something>
TimeFrameRestore();
}
I view this in 60 second interval chart. Everything is fine here. However, the dates and entry exit price in backtest result list are off by 55 minutes.
I added timeframeExpand()
//Running this in backtest in periodicity 5 seconds
if(status("action")==5 ||status("action")==6)
{
TimeframeSet(60);
short=<something>
cover=<something>
TimeFrameRestore();
Short=TimeFrameExpand(Short, 60);
Cover=TimeFrameExpand(Cover, 60);
}
but still no luck.
Can you tell me which arrays i need to expand other than short, cover, buy, sell and shortprice, coverprice, buyprice, sellprice to get trades in aa result list. I have expanded and done exrem and can see the correct values in exploration but the trade result list still won't show any trades,
Since you have not followed @Tomasz advice about posting your actual code, the best we can do is point you to some debugging guidelines: How do I debug my formula?. If you're confident that signals are being generated correctly (did you use Scan?), then I suggest starting with the Detailed Log to see what AB is doing with those signals. Also make sure you've actually enabled Short trades in the analysis settings.
The psuedo code that i posted is representative of my system. my afl has 4k lines so it will only confuse everyone if i post it here.
I am looking at detailed log and i can see the posSize is 0. I will fix that and post back the results here. Thanks Matt.
I got the trade. Thanks Matt
Remember - if you give "pseudo code" you will receive "pseudo solution". Quality question results in quality answer. And vice versa. Garbage in, garbage out.
You should send ACTUAL CODE (entire code), not "pseudo code".
Please follow this advice: How to ask a good question It is explained WHY we need RUNABLE formula, not pseudo-code.
If i had posted the code, which is very long, it would have just confused the reader. Instead I posted representative code which fully represents the nature of my actual code. I would appreciate if you don't use curse words like RTFM and thereby maintain the level of discourse. Also my last question has been waiting in the moderation queue for 2 days so please let it be posted.
When i have code (AFL or otherwise) that is too long or complicated to clearly demonstrate an issue, I begin by creating the simplest possible example that still causes the issue to occur. Not only does this help me better understand where the underlying problem likely resides, but it's a courtesy to whoever might be willing to help me out. My time spent simplifying saves them time trying to understand details that are not relevant. I figure that the more effort I expect from a stranger, the less inclined they will be to help me.
FWIW: RTFM stands for please Read This Fine Manual. Internet later assigned other expansions but originally RTFM was used in the army:
Quoted from: RTFM | Know Your Meme
Although largely unsubstantiated, usage of RTFM may have begun as a military lingo during World War II, when the phrase "Read The Field Manual" became a staple expression among American soldiers in response to basic questions asked by new enlistees. First introduced in 1939, US Army Field Manuals instructed all the vital, necessary skills for a soldier, from how to fold your clothes properly to how to toss a grenade inside the enemy’s tank.
You got that after showing a number of times that you ignore docs and instructions. Did you bother to read this: How to ask a good question
I guess not because your answers clearly suggest that you didn't.
If you did you would read this (quote from How to ask a good question)
post a minimal, but working code demonstrating the problem
So, no-one asked you to post thousands of lines. You have to post a minimal, but working code demonstrating the problem
If you fail to provide required information you are not going to get answers. We don't have magical mirrors and we are not mind readers.
Typically problems arise in OTHER parts of the formula than the poster thinks. Long spaghetti code tends to be problematic. By simplyfying formula for the purpose of forum, you might find the problem yourself. The process of cleaning up might be enlightening.
As written in (already quoted) How do I debug my formula? it is in YOUR best interest to understand your own coding.
Your posts clearly shown that you don't understand it yet. All AmiBroker functions work 100% fine. It is YOUR best interest to spend time reading the docs, trying some exploration code and figuring it OUT YOURSELF to get better understanding what happens inside YOUR OWN code. No one will teach you how to swim without you being immersed in the water.
Here is some more interesting links on this forum: How do I learn AFL?
This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.