Posted By: BobbyT
Trades not appearing with call to plot() - 07/04/17 01:15
Hi all,
Back again with another noob problem.
The basic RSI strategy I coded and posted about here: http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=466814#Post466814
will plot its trades on the price chart with the following call:
...yet another script I wrote as a foray into writing my own indicators does not plot trades. It is definitely taking them and the indicator values are plotted too. Just no trades.
Here's the full code:
I'm truly sorry about posting such a quick succession of seemingly simple problems. This forum is the only resource (besides the zorro manual) that I have been able to find. And although the manual is pretty good, it doesn't (understandably and rightfully so) cater to those who are complete programming novices (novicii?). Once I get off ground floor I can start returning those helping hands.
Back again with another noob problem.
The basic RSI strategy I coded and posted about here: http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=466814#Post466814
will plot its trades on the price chart with the following call:
Code:
set(LOGFILE); //PlotWidth = 600; //PlotHeight1 = 300; plot("Signal",series(RSI(series(priceClose()), 14)),NEW,RED); plot("Threshold1",75,0,BLACK); plot("Threshold2",25,0,BLACK); set(PLOTNOW);
...yet another script I wrote as a foray into writing my own indicators does not plot trades. It is definitely taking them and the indicator values are plotted too. Just no trades.
Here's the full code:
Code:
//----globals var sixthLen = 1682; var splitBy = 6; var TP = 100*PIP; //takeprofit in pips converted to price value var buffer = 20*PIP; //distance from market for pendings to be placed var tradeLim = 2000; //----sixths functions var sixthHigh(period, splitBy) { return (HH(period) - ((HH(period)-LL(period))/splitBy)); } var sixthLow(period, splitBy) { return (HH(period) + ((HH(period)-LL(period))/splitBy)); } //----order functions function CheckForLongOpportunity() { vars Price = series(price()); //create the price series for the selected asset //check to see if we can enter a long if(NumOpenLong + NumPendingLong < tradeLim) { if(crossUnder(Price, sixthLow(sixthLen, splitBy))) { enterLong(0, price() + buffer, 0, TP); //reverseShort(1); } } } function CheckForShortOpportunity() { vars Price = series(price()); //create the price series for the selected asset //check to see if we can enter a short if(NumOpenShort + NumPendingShort < tradeLim) { if(crossOver(Price, sixthHigh(sixthLen, splitBy))) { enterShort(0, price() - buffer, 0, TP); //reverseLong(1); } } } //----main exectution block, comparable to OnTick() function run() { BarPeriod = 60; LookBack = sixthLen; //PlotBars = 500; StartDate = 2010; EndDate = 2015; //check to see if we should open a trade CheckForLongOpportunity(); CheckForShortOpportunity(); set(LOGFILE); plot("Lowest", LL(sixthLen), 0, BLACK); plot("Highest", HH(sixthLen), 0, BLACK); plot("upperTZ", HH(sixthLen) - ((HH(sixthLen)-LL(sixthLen))/splitBy), 0, RED); plot("lowerTZ", LL(sixthLen) + ((HH(sixthLen)-LL(sixthLen))/splitBy), 0, RED); set(PLOTNOW); }
I'm truly sorry about posting such a quick succession of seemingly simple problems. This forum is the only resource (besides the zorro manual) that I have been able to find. And although the manual is pretty good, it doesn't (understandably and rightfully so) cater to those who are complete programming novices (novicii?). Once I get off ground floor I can start returning those helping hands.