Hi,
I must have done something wrong but I don't have a clue what.
Today I opened AB and displayed a 5Mn chart with a formula Iindicator I spent days building. I switched to daily, then from right click context menu, I "deleted" indicator containing my formula. I only wanted to remove it from chart, not delete it.
When I added it back to my chart, it displayed only price and a moving average.
All my code was gone from the indicator file except for price and ema. File was still here but content was changed.
Is there a way to restore or find previous copy of the file or find it somewhere?
What could I have done to wipe out content of indicator file?
Back then when you had created that formula and after it was finished did you double click that formula to bring it to chart (equal to "insert" option) or have you used "insert linked" option? See https://www.amibroker.com/guide/h_dragdrop.html
Difference between double-click ("insert") and "insert linked":
How to use 'drag and drop' charting interface
Q. What is the difference between Insert and Insert Linked option in chart menu?
A. Insert command internally creates a copy of the original formula file and places such copy into hidden drag-drop folder so original formula will not be affected by subsequent editing or overlaying other indicators onto it. Double clicking on formula name in the chart tree is equivalent with choosing Insert command from the menu. On the other hand Insert Linked command does not create any copy of the formula. Instead it creates new chart pane that directly links to original formula. This way subsequent editing and/or overlaying other indicators will modify the original
If you have double clicked it from "Charts" window then the original formula should still be in "Custom" folder of "Charts" window if you have saved it there originally (if it was not created in Custom folder then look into the one it was saved to).
If you have used "insert linked" option then I fear your formula is lost.
If you have created that formula in a formula already been double clicked to chart before you started your additional formula creation in there then I fear it is lost too.
Simple rule... always do backups.
Now, if you say what it is about then we may try to re-create here.
Thank you for your answer.
I must have inserted linked: the only file there is in "custom" from inside AB, and in the real windows directory both shows same modified code.
I'll be extra careful on the step I will take when adding my next indicator as to try understanding when in the sequence did it happen.
What is strange is that the physical file shows a modified date of today, when I never saved the file.
Also it is strange that the file is not just totally empty, but contains price and ema plot. Why did it replaced my entire code with specifically those 2?
Now, if you say what it is about then we may try to re-create here.
Thank you very much for your proposition.
I think i'll be able to reconstruct it from all the browser tabs still open that I used to help me build it initially.
Strange things almost never happen. We are not on "The X-files".
You have written yourself in first post that you have modified (deleted) part of code from AFL file today.
->
So you modified that file yourself today. AmiBroker is formula driven.
"Delete" option does what it says... it deletes code from file (and it even comes with pop up warning before deletion). "Delete" does not mean to close chart pane.
Tools - Preferences - Charting:
"Delete" is not a problem if you have double-clicked ("insert) original formula to chart (as mentionend in second post) because then original formula still exists in Charts window. But "Delete" is problem if "insert linked" was used. Then original formula is getting modified.
To close chart pane you either click the small cross on top right corner of a pane.
or choose "close" from chart's right click context menu
I see... I should have closed the pane instead of deleting.... it deleted a section inside the file where most of the code was. It was inserted linked.
Thank you for explanation.