Simple Coding Help - No Promise.

Quantx functions are used by one of the broker's plugin for sending orders from amibroker to a trading terminal. It is not just DLL that you can copy and use. You will also need a valid trading account with the broker for it to work.
Dear MasterMind,

Help requested kindly...I have already completed the excel format of my trader's navigator which i use to trade on the nigerian stock exchange. Can i send you my attempts at afl coding it?

I remain.

Mike-Ekwueme (respartner)
 
Hello mastermind sir,
Thanks for your reply.
Can we use the code by removing quantx function. (Or) the logic code is hidden in the DLL file?

Thanks
You can remove references to Quantx* functions.

Quantx_ functions are to export signal out of Amibroker into some algo trading terminal.... Removing them will not impede the AFLs logic or usability in any way.
 
Hello Happy Singh
I was wondering if you could offer your advice on my backtesting related query. I posted it on another thread and am posting it here for your consideration.
I am new to coding, and am trying out a simple strategy just for practice purposes. I am trying to generate a realistic BuyPrice for my AFL.
After a buy signal is triggered, I want the BuyPrice to be set to the low of the next 1 minute bar.

I know that I can use something like the following:
Code:
SetTradeDelays(1,0,0,0);
BuyPrice=low;
Things go on smoothly when I am backtesting my strategy with 1minute time frame. But I want to run my strategy on an Hourly timeframe. In such a case, with the above code, my BuyPrice is triggered at low of the next hourly candle after buy signal. But I want BuyPrice to be the low of next 1 minute bar and not the next 1 hour bar. Could this be done on a hourly chart?

Any help will be greatly appreciated.
Thanks
 
Hello Happy Singh
I was wondering if you could offer your advice on my backtesting related query. I posted it on another thread and am posting it here for your consideration.
I think coding for it should be possible . . .

But Everyone here would be curious to know how to implement it :)

How does one ever buy the low of a candle . . .
wouldn't that make it a holy grail of trading,
and next comes what sell at the high of the same candle :D


Anyway . . . for coding


Use 1 minute TF

implement the trading logic in Hourly TF by using

1) TimeFrameSet(Hourly);
2) Implement your trading logic
3) Restore TF,
4) Expand signals and then use low on next candle (as you are on 1 minute TF)
5) do whatever magical thing you want to do


Cheers


Happy :)
 
Yes, it would be a big miracle if I can consistently buy at low of candle.
 
How does one ever buy the low of a candle . . .
wouldn't that make it a holy grail of trading,
and next comes what sell at the high of the same candle
Ohh, I see. I want to backtest with worst possible case scenario. I should have really meant buyprice should be set to high of next 1 minute bar(not low!!! ) . It was an unintensional error.

Thanks for your reply though. But I am still a newbie at coding. How to " Expand signals and then use low on next candle (as you are on 1 minute TF) "
Here's how I plan to code:

Code:
TimeFrameSet( inHourly ); // switch to generate buy sell signals in hourly TF 

buy=My condition;   //generate buy signal in hourly TF
sell=My condition;   //generate buy signal in hourly TF

TimeFrameRestore();

TimeFrameSet( in1Minute ); // switch now to 1minute TF

SetTradeDelays(1,0,0,0);
BuyPrice=high;

TimeFrameRestore();
Is this appropriate?
 
Last edited:
Ohh, I see. I want to backtest with worst possible case scenario. I should have really meant buyprice should be set to high of next 1 minute bar(not low!!! ) . It was an unintensional error.

Thanks for your reply though. But I am still a newbie at coding. How to " Expand signals and then use low on next candle (as you are on 1 minute TF) "
Here's how I plan to code:

Is this appropriate?
yes small changes, refer to Amibroker help file for multi timeframe usage spefically use of expand- first/last options
also use ExRem to remove excess buy/sell signals

Code:
TimeFrameSet( inHourly ); // switch to generate buy sell signals in hourly TF 

MYbuy=My condition;   //generate buy signal in hourly TF
MYsell=My condition;   //generate sell signal in hourly TF

TimeFrameRestore(); // this restores to original to 1 minute TF

Buy = TimeFrameExpand(MYBuy, inHourly);  / converts signals back from hourly to current TF (i.e. 1 Minute)
Sell = TimeFrameExpand(MYBuy, inHourly);

SetTradeDelays(1,1,1,1);
BuyPrice=high;
Happy :)
 

Similar threads