Creating a macro to accomplish traditional for loop

I have read up on macros recently and was thinking about attempting to employ the traditional for loop mechanism.

One way around this was to create a function, which I have been using for some time, that gives me a really easy way of dealing with the lack of for loop functionality:

public static function tradFor(variable:Dynamic, condition:Void -> Bool, loopOnMet:Bool = false, callback:Void -> Void = null):Void
{
    while ((condition()) == loopOnMet)
    {
        callback();
    }
}

Using the following example:

var i:Int = 0;
var MAX:Int = 50;
var condition = function() {
    i++;
    return ((i < MAX) == true);
}
        
var callback = function() {
    trace(i);
}
        
tradFor(i, condition, true, callback);

Now naturally, I want to try to reduce all of this effort by effectively making the tradFor function a macro that allows me to do this:

tradFor(i, i < MAX, i++, callback());

I have literally no experience with macros, so is there anyone out there that may be able to help me accomplish this? The current haxe for loop is very restrictive and confusing, and you can only increment from 0 when using an iterator. At least as far as I know, not sure if my choice of words was correct, either.

Oh, haha. Didn’t know that existed. Thank you.