Posted By: luisd
LMT short + MaxShort + LifeTime; is this working as expected - 02/19/18 17:57
A simple script that is supposed to sell short limit 20 pips above the low of the day and hold for 1 bar and aplly MaxShorts =1;
Is this working as expected?
Is this working as expected?
Code:
function run() { set(PLOTNOW); BarPeriod = 60; LookBack = 120; MaxShort = 1; StartDate = 20121201; EndDate = 20130301; PlotDate = 20130101; PlotBars = 240; PlotWidth = 800; PlotHeight1 = 600; PlotScale = 8; ColorDD = 0; ColorEquity = 0; int barsLookback; int numDaysBack = 0; // LOW OF DAY (LMT ENTRY SHORT PRICE) barsLookback = timeOffset(CET,0+numDaysBack,22,1); if(barsLookback <= 0) if(ldow(CET,0+numDaysBack) != 1) barsLookback = timeOffset(CET,1+numDaysBack,22,1); else barsLookback = timeOffset(CET,2+numDaysBack,22,1); vars highs = series(priceHigh()); vars lows = series(priceLow()); var LOD = MinVal(lows, barsLookback); EntryTime = 1; LifeTime = 1; var entryPriceS = LOD + 20 * PIP; plot("entryShort",entryPriceS, MAIN, BLUE); enterShort(1, -entryPriceS, entryPriceS + 200 *PIP); }