QuickGFX feature feedback

Yes, as mentioned the 1st picture shows a test using gfx functions only. The 2nd is a classic Rainbow indicator:

side = 1;
first = Param("smallest avg",10,10,100,10);
last = Param("largest avg",80,20,200,20);
increment = Param("increment",2,1,10,1);

effect = ParamToggle("3D effect ?", "No|Yes", 1);
saturation = Param("saturation", 128, 0, 255);
brightness = Param("brightness", 255, 0, 255);
graph = ParamToggle("graph ?","No|Yes",1);

if (graph) PlotOHLC(O,H,L,C,"",colorDefault,styleCandle);

Score = 0; nb = 0;

for(i = first; i < last; i = i + increment) {
	up = MA(C, i);
	down = MA(C, i + increment);
	
	Score = Score + (C > up); nb++;
	
	if (effect) side = IIf(up <= down AND Ref(up <= down, 1), 1, 0.6);
	PlotOHLC(up,up,down,down, "AM"+i, 
		ColorHSB(3*(i-10), saturation, side * brightness), 
		styleCloud|styleNoLabel);
}

1980*1024

1 Like

6000 Visible bars
4K Full screen

GDI 1428 ms
QGFX 629 ms

styleCloud is not using QuickGFX code path in 6.40.0, it still falls back to GDI. In 6.40 only styleLine, styleDots, styleHistogram, styleCandle, styleBars, and VAP overlays are using new code path. The QuickGFX is faster in your rainbow formula for other reasons (remaining parts of the chart).

1 Like

Fine. Indeed if I replace styleCloud by styleLine I get 4ms with QuickGfx vs 60ms with GDI.
This morning I benchmarked a dozen of classic indicators(rsi, macd, boll, tdi, stoch...). Charts rendering increases by a 19 (geometric) average factor on my laptop. It's too bad I don't use them but so far so good for the new renderer.

1 Like

As I mentioned earlier, QuickGFX is under development and more and more areas will be handled by new code, eventually removing remaining GDI fallback altogether. Since it means effectively re-implementing all functionality provided by Windows GDI its quite a bit of work.

1 Like

Any news about new release AmiBroker with QuickGFX?

Please be patient. It is not only QuickGFX, there are many other features and documentation review and update. It takes time. And this needs to be done with my own bare hands. For various reasons I can't devote 16 hours per day for programming as I did 15 years ago.

6 Likes

Some update on progress. Two issues reported earlier are fixed already.

With regards to diminishing returns for 'large number of bars' case explained here: QuickGFX feature feedback - #28 by Tomasz -

with in-development version performance with large number of bars (>500K bars) has been improved by factor of 3 by means of replacing C++ compiler output with hand written optimized assembly. Improvements were done to BOTH GDI and QuickGFX paths so both benefit about the same factor.

6 Likes

OK, some more update on this. I have spent enormous amounts of time on code refactoring and re-implementation of drawing algorithms in "bare metal", the work is not over. There are some impressive speed-ups such as >100x speedup in styleCloud (especially with different outline/fill colors). There are some other places that I still need to work on. Tweaking assembly output is quite fun, but time consuming. It is also fun to see the rendering time dropping from 490ms down to 4ms. There will be a release in December as I promised but it will certainly not be "final word" from me. This work is not only about the speed. It opens up also new possibilities for the future including per-primitive per-pixel alpha, that were unavailable via GDI.

10 Likes

:clap: :clap: :clap:I am with you :heart:. Last months my time at work are 18 h per day.

Tomasz, does this mean, that the things described in the post below will be achievable now? That would be a very interesting feature ...

2 Likes

Yes once you bypass all libraries and OS to draw everything on bare-bone level accessing raw bitmap data and each pixel "by hand" you are free to do basically anything. You are also forced to re-invent the wheel several times (you don't have any high-level function to draw anything, you are down to mov DWORD PTR [edx+esi*4], eax assembly instruction). Per-pixel alpha is costly because instead of just writing data you have to read-multiply-add-write-back but other than that doable.

7 Likes

@Tomasz I'm sorry for asking here (I decided to do it because I know the new version is coming soon), but would it be possible for you (if it doesn't require a lot of work) to add an option allowing to turn the Crosshair on/off from AFL in selected chart panes in a similar way to SetChartOptions( chartHideQuoteMarker)?

Crosshair ON is very useful when working with standard charts (at least I like to have it ON) but at the same time it usually interferes with graphical elements like custom panes, lists, buttons etc. created by user via gfx functions.

For that reason, instead of deciding whether turn it on/off in the whole program it would be great to be able to switch it on/off in each chart pane separately.

That would really help me. I wouldn't have to use my own custom crosshair (coded in AFL and applied only in selected chart panes) which is a worse solution than the original one.

If it's too late or you find this idea not worth the hassle, I will understand :slight_smile:

Thank you

2 Likes

It is too late for 6.40.2. At some point I need to stop adding stuff, so I can actually release anything.

1 Like

Thank you for the reply. Of course I understand. If you find my idea worth considering and there is a chance it might appear in one of the next releases, it will be great :slight_smile:

I just received yet another "brilliant" "bug" claim.

Just a note: before you report "bugs" please check the very first post that explains what is implemented and what is NOT in QuickGFX. Specifically lines THICKER than 1 can only be SOLID as of 6.40.2 and quite frankly don't expect non-solid styles for anything wider than 1 pixel anytime soon. If you need them use GDI. QuickGFX is work in progress. It is marked as experimental. I am not Microsoft and do not hire 1000 people and rewriting half of the OS is not one week work. So don't expect that I will rewrite Windows OS over 0.00.2 version increase.

Hearing "reports" about non-existing bugs is hugely annoying.

The version increase of 0.00.2 brought you 28 changes, I think it is way more than enough. Every single line in the change log means anywhere from couple of HOURS to couple of DAYS of work. Things that are NOT mentioned are NOT implemented. My back is aching and I need rest. So unless you have something positive to say, please let me rest at least for last day of the year and refrain from reporting "bugs" that don't exist.

CHANGES FOR VERSION 6.40.2 (as compared to 6.40.0)

  1. 32-bit/Charts: x87 assembly code used for faster conversion from float to int. This gives +20% performance improvement in both GDI and QuickGFX rendering modes
  2. 64-bit: the size of internal exit signal structure increased to allow backtest with more than 1 million symbols (at the cost of increased RAM usage). 32-bit version still uses smaller structure and 1 million symbol limit
  3. AFL Editor: Defunct Print menu option removed from context (right-click) menu. Working Print option is available in File->Print menu
  4. AFL: _SECTION_BEGIN() - section name is checked against not allowed control characters
  5. AFL: ADX/PDI/MDI protected against division by zero when data are completely flat (H == L == C for long periods of time)
  6. AFL: array version of ColorHSB function is 50% faster now
  7. AFL: new function BarsSinceCompare( past, comparison, current ) - for every bar, compare past array values with current bar value and return the number of bars since last time comparision was true
  8. AFL: New warning 511 for incorrect usage of IIF function: "Assignment within IIF function arguments. Use IIF() return value instead"
  9. AFL: Param*() functions check if user passed non-printable/control characters, that are forbidden in parameter names and display appropriate error message
  10. AFL: regression new Error 72 was incorrectly generated when amount was zero but mode was set to Disable (like in Equity.afl file). The combination of zero amount and disable is of course valid and error is no longer produced in such case.
  11. AFL: Status("baseinterval") - new field "baseinterval" returns database base time interval setting in seconds
  12. AFL: Warning 501 (assignment within conditional) is silenced if assignment is made to the variable that wasn't intitialized before (i.e. it is first assignment of given variable ever in code)
  13. AFL: Warning 512 added to detect overusage of Foreign/SeForeign calls
    Analysis report charts: regression: when QuickGFX was enabled, report charts could cause exception. Fixed.
  14. ASCII import: combination of $HYBRID 1 without "autoadd" mode produces an error on non-existing symbols now.
  15. Charts: 40% speedup in determination of auto-scale min/max (signficantly affects chart rendering performance for very large number of bars >500K)
  16. Charts: Bar-to-XPixel coordinate conversions speeded up 3x by using assembly in 32-bit and _div64/__emul intrinsics in 64-bit versions
  17. Charts: GDI rendering of cloud style charts is now 2x faster
  18. Charts: QuickGFX rendering of cloud style charts is now 100x faster
  19. Charts: when QuickGFX was enabled multi-color title text was slightly truncated at the color boundaries. Fixed.
  20. DB: when user renames the symbol corresponding Note text file name is renamed accordingly now
  21. Fixed regression introduced in 6.39 when the very last value in MA was non-Null even if there was not enough data
  22. New Analysis window: #pragma sequence(scan,backtest) - and new "Run Sequence" button to run same formula with same settings several times in sequence using different modes
  23. OLE: added Stock.Quotations.Adjust() function. long Adjust(BSTR pszFieldList, float fMultiplier, float fOffset, DATE dDateTime, boolean bBefore)
  24. QuickGFX: Line width > 1 implemented
  25. QuickGFX: New lines in Title variables caused double spacing. Fixed
  26. QuickGFX: styleHistogram was invisible for negative values. Fixed
  27. UI: Param window, names of parameters are not tructated on HighDPI screens anymore
  28. When worker thread attempted to read string from resources sometimes resource handle was set incorrectly, this caused COleException / unknown error. Fixed by replacing faulty MS CString::LoadString implementation.
9 Likes

Tomasz thank you for the new release!

I just want to make sure. As I understand per-pixel alpha is not available for the users yet and it might be introduced by you in the future. Am I right? I'm asking because maybe it is already available but hidden and one needs a magical key to unlock it? :wink:

As I wrote: only things mentioned in the read me (and release notes) are done. Things that aren't mentioned are not done. Since per-pixel per-primitive alpha is not mentioned, it is not available in 6.40.2.
Even if I have concept completed in my mind it still needs manual labor to actually type that in the form of the program: Amadeus - "The rest is just scribbling and bibbling..." - YouTube

1 Like

Yet another benchmark showing QuickGFX improvements vs Windows GDI:

In 6.40.2 with 5000 bars this runs 100x faster with QuickGFX vs GDI

side = 1;
increment = Param("Increment",1, 1, 80, 1 );
for( i = 10; i < 80; i = i + increment )
{
 up = MA( C, i );
 down = MA( C, i + increment );

 if( ParamToggle("3D effect?", "No|Yes", 1 ) )
   side =  IIf(up<=down AND Ref( up<=down, 1 ), 1, 0.6 );

SetBarFillColor( colorGreen );
 PlotOHLC( up,up,down,down, "MA"+i, ColorHSB( 3*(i - 10),
           Param("Saturation", 128, 0, 255 ),
           
side * Param("Brightness", 255, 0, 255 ) ), styleCloud | styleNoLabel );
} 

QuickGFX render time 2ms, GDI render time: 283ms

8 Likes

great, i was using QuickGFX from the last update because the negative values for styleHistogram was fixed. Seems to work fine, I did not encounter any problems. Just because certain styles are not yet supported I switch back to the old mode sometimes.