Thanks a lot for your reply
tradePrices = ValueWhen(Buy OR Sell, BuyPrice, 2);
AddColumn(tradePrices, "Price of last buy or sell");
buy = IIF(C < 0.99*tradePrices, True, buy);
sell = IIf(C > 1.01*tradePrices, True, sell);
when i use your code it says that buy and sell have not been initialized.
could this be the problem i have? So I initialize the values with 0 and 0
buy=0;
sell=0;
tradePrices = ValueWhen(Buy OR Sell, BuyPrice, 2);
AddColumn(tradePrices, "Price of last buy or sell");
buy = IIF(C < 0.99*tradePrices, True, buy);
sell = IIf(C > 1.01*tradePrices, True, sell);
There are no trades so possibly the condition never triggers so i will add a little OR EMA CROSSOVER to help so THERE is some conditions in which at least we have ONE trade
buy=0;
sell=0;
tradePrices = ValueWhen(Buy OR Sell, BuyPrice, 2);
AddColumn(tradePrices, "Price of last buy or sell");
buy = IIF(C < 0.99*tradePrices, True, buy) OR EMA(C,10)>EMA(C,50);
sell = IIf(C > 1.01*tradePrices, True, sell) OR EMA(C,10)<EMA(C,50);
I am getting the full trade list on "backtest" but i am not getting anything at all on explore. Also when trying with debug although having hundreds of trades the variable tradeprices always appears as EMPTY
So effectively the trade crossover is making many trades
For some kind of reason is like the software is unable to get the value of Buy & sell into a variable.
Buy Tradeprices is always Null
Maybe nz(Buy,0) or nz(sell,0) ?
Nothing, the same.
And don't you believe that BuyPrice is empty
Nothing, still null forever on tradeprices. So i will separate both conditions on two variables so i can see if those depending on tradeprice do ever get executed or are just the emas
So this is the code
/*
...Set Buy and Sell arrays...
*/
Buy=0;
Sell=0;
tradePrices = ValueWhen(nz(Buy,0) OR Nz(Sell,0), BuyPrice, 2);
AddColumn(tradePrices, "Price of last buy or sell");
cond1=C < 0.99*tradePrices;
cond2=C > 1.01*tradePrices;
cond3=EMA(C,10)>EMA(C,50);
cond4=EMA(C,10)<EMA(C,50);
buy = IIF(cond1, True, buy) OR cond3;
sell = IIf(cond2, True, sell) OR cond4;
And this is the situation:
So cond1 is never triggered and that is not true. there have been hundreds of times the price has moved more than 1% under.
I really don't get it.
Posted by: dpellon@gmail.com
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (12) |
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
EmoticonEmoticon