I have written a code in which the buy/sell signals are calculated based on the prices of NIFTY ticker.
Now i want to use buyprice/sellprice/shortprice/coverprice from ticker name "NIFTY_F1".
I have written code and it is not taking buyprice/sellprice/shortprice/coverprice from ticker name "NIFTY_F1", instead it is taking prices from NIFTY ticker itself and that too only HIGH and LOW of NIFTY. Below is my code.
Buy = IIf( SuperTrend<Close, 1, 0);
Sell = IIf( SuperTrend>Close, 1, 0);
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Short=Sell;
Cover=Buy;
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);
closePrice = Foreign( "NIFTY_F1", "C" );
buyPrice = ValueWhen(Buy, closePrice);
sellPrice = ValueWhen(Sell, closePrice);
shortPrice = ValueWhen(Short, closePrice));
coverPrice = ValueWhen(Cover, closePrice);
I also tried using below code and using C1 in place of closePrice in above code . But no luck.
SetForeign( NIFTY_F1 );
C1 = C;
O1 = O;
RestorePriceArrays();
Please help. I dont know what im doing wrong. Let me know if you need more clarification on question.
I also attached snaps. Please find attached.