Trading system with timeframe less than a minute?

Hello guys.
Is it possible to create an algorithm which will react to the instant price change, without waiting for a minute (I work with minute time frame) to end?
For example when I see that current price is lower than previous bar Close, then execute Sell immediately.

Hope my explanation makes sense.

Thank you.

When you use streamirg rt data it does not wait. Last bar close is your instant Last trade price updated many times per second and you can just use it.

2 Likes

I see. Thank you for clarifying that.
I've found a solution (as I think) here
So to print price every second I am using this formula now.

printf("\nPrice is " + TC=TimeFrameGetPrice("C",1,0));

But I have also found a GetRTData command.
May I ask what is a benefit/difference of using GetRTData for such purpose?
Because I do not have a professional version of Amibroker yet, but we are considering it.

Thank you.

@Konstantin GetRTData() retrieves the LAST (the most recent) value of the fields reported by streaming real time data source (usually not available in another way). Read here:

https://www.amibroker.com/guide/afl/getrtdata.html
https://www.amibroker.com/guide/h_rtsource.html

In your case you just need to use LastValue(C). As Tomasz wrote above:


Don't use some strange solutions from the link that you provided and don't use your above code for that! Lastvalue(C) is identical in every timeframe! The important thing is that you need the last value of Close to avoid displaying values of some other bar!

4 Likes

Hello
I would like to add one more comment to your above sentence.
If you said ""For example when I see that Open price is lower than previous bar Close"" would be better.... because you can control that Open price of this bar to backtest your system or to do any exploration.
But with this logic current price is lower than previous bar Close you canot do anything.
Lets make a question here to understand why?
How do you know if on the next second the current price is higher than previous bar? Is Not possible to know that :wink: (spesial if you dont have tick data)

1 Like

Yes I agree with @PanoS. Such approach is not suitable for backtesting, because the LastValue(C) fluctuates all the time during market ours (when you are connected via rt plugin). If someone uses GetRTData("Last") - last trade price, instead of LastValue(C), it will return {EMPTY} when not connected via plugin - not the last value of Close.

1 Like

Thank you guys for all the help and suggestions. I will use LastValue(C) from now on.

Hope that I don't confuse anyone, but I want to create a system that can react to real-time data (look at each second price change). And close the position before 1 minute candle/bar is complete because of high volatility of the symbol.
We are using realtime data with DDE plugin.

Also my colleague provided me with 5 second data (I believe he got a professional Amibroker version to do that), which I plan to use for backtesting.

Sorry I meant if realtime data is used. Or at least local database with data in seconds.

Thank you all for such great support! :sunglasses:

2 Likes