Announcement

Collapse
No announcement yet.

STOCK trading system building

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • STOCK trading system building

    hi there i'm in the middle of building a back testing system, but i'm somewhat stuck in the middle.
    Basically, i want to find stocks within a tight range in the morning.
    Those are the conditions that I want.

    1) 9:30-9:45 range should be lower than 14 days ATR*0.25
    2) That 15m range should be less than 0.45 cents
    3) The average std(standardization) of 15m(HIGH,LOW,OPEN,CLOSE)/ stock mean price of 15m * 100 should be lower than 0.1


    Long condition(1-3 conditions are already met)
    1)Open change of that stock- open change of spy> 0
    =>If it breaks above the high of the 15m range go long

    Short condition(1-3 conditions are already met)
    2)Open change of that stock - open change of spy <0
    =>if it breaks below the low of the 15m range go short

    Stop
    =0.10 cents(fixed)

    Profit
    1)First target= the range of 15m
    2)hold the half to the daily ATR range




    function preMain() {
    setPriceStudy(true);
    setStudyTitle("Back Test: Low ATR Breakout");
    setCursorLabelName("15range", 0);
    setDefaultBarFgColor(Color.RGB(0x00,0x94,0xFF), 0);
    }

    var bInit = false;
    var fifteenmin_high;
    var fifteenmin_low;
    var stock_open;
    var stock_close;
    var spy_open;
    var spy_close;
    var long_trade_setup = false;
    var short_trade_setup = false;
    var nstop;
    var range;
    var target;

    function main() {
    if (getCurrentBarIndex() == 0) return;

    if(bInit == false) {
    fifteenmin_high = 0;
    fifteenmin_low = 0;
    bInit = true;
    }

    var bExitFlag = false;
    if (strtegy.isInTrade() == false) {
    nStop = null;

    }

    if(getHour(0) ==0 && getMinute(0)==30){
    fifteenmin_high = high(0);
    fifteenmin_low = low(0);
    range = fifteenmin_high - fifteenmin_low;

    if( atr(5, inv("D"),-1) * 0.25 fifteenmin_high - fifteenmin_low) {
    long_trade_setup = true;
    short_trade_setup = true;

    }
    }

    if( low(0) < fifteenmin_low)
    long_trade_setup = false;
    else if( high(0) > fifteenmin_high)
    short_trade_setup = false;

    return;
    }
    this is where i'm stuck and i have added StandardDeviation.efs as well.
    Attached Files
Working...
X