A free tool i just build to find algorithmic strategies

sure lets do an example strategy

So i searched for a strategy on VIX week data (which is part of the predefined data sets)
I searched for a Long strategy with only 1 condition (so its super simple and not overfit)
I used 100% of the data to find the strategies

the VIX week dataset has 544 bars
The best strategy (after 10 cycles):
PF 1.8
trades 233

in app graph
View attachment 236714

the code
Code:
int OnInit()
{
  return(INIT_SUCCEEDED);
}

void OnDeinit(const int reason)
{
}

double getHighLowDiff_1() {
  return iHigh(NULL, PERIOD_W1, 1) - iLow(NULL, PERIOD_W1, 1);
}



double getClose_1() {
  return iClose(NULL, PERIOD_W1, 1);
}



double getAvgPriceLow_50_2() {
  return iMA(NULL, PERIOD_W1, 50, 0, 0, PRICE_LOW, 2);
}



double getCondition_0() {
  // PriceDiffThenPrevPrice(Close,AvgPriceLow(50),-0.07975,false,1,0.455078125)

  double diff = getClose_1() - getAvgPriceLow_50_2();
  double hl = getHighLowDiff_1();

  if(hl == 0){
    return false;
  } else {
    double diffP = diff / hl;

    return diffP < -0.07975;
  }

}


bool isLong()
{
   for(int i = 0; i < OrdersTotal(); i++)
   {
      if(OrderSelect(i, SELECT_BY_POS))
      {
         if(OrderType() == OP_BUY || OrderType() == OP_BUYLIMIT || OrderType() == OP_BUYSTOP)
         {
            return true;
         }
      }
   }
   return false;
}


void makeOrder()
{
 
  double level = Ask;


   OrderSend(Symbol(), OP_BUY, 1, NormalizeDouble(level, Digits), 0,0,0);
}


void closeLong()
{
   for(int i = 0; i < OrdersTotal(); i++)
   {
      if(OrderSelect(i,SELECT_BY_POS))
      {
         if(OrderType() == OP_BUY)
         {
            int ticket = OrderTicket();
            double usedAmount = OrderLots();
            OrderClose(ticket, usedAmount, Bid,1);
         }
      }
   }
}


void OnTick()
{

  bool isTrade = isLong();

  bool shouldBeTrade = getCondition_0();

  if(shouldBeTrade && !isTrade){
    makeOrder();
  } else if(!shouldBeTrade && isTrade){
    closeLong();
  }
}

if nothing else one could read that the close of the last bar needs to be low and after that the strategy goes Long.
Which fits my knowledge (that the vix likes to return to some average price)

Now if you saw the graph in app its not very good but because its in the market almost half of the time many trades are merged (because you would have to otherwise reopen a trade right after closing one)

so in MT4 the graph looks like this
View attachment 236715

and 223 trades shrink to 46 (not only because of merging but also because MT4 maximum test trading period is Daily and so not all Week data is used (the daily data starts later))

last few trades
View attachment 236716

MT stats
View attachment 236717

....
so i also tried to search for strategies with 2 conditions.
it wasn't essentially better but similar results were achieved on much less trades (so technically you could use the free money on something else...)

Anyway i like VIX, its an easy market for me.

edit: one more thing, i do use strategies like this one yes, but this tool is new so i cant give real life results from it

Thanks for the detailed post. Going to look it over more closely later.

You said you used 100% of the data.

Can it train (and validate, if it does that) on, say, 50% of the data, then backtest on the out-of-sample other 50%?

Backtesting on OOS data will give a more accurate clue as to real world performance.
 
@userque sure you can train on 50% of the data. You will see the profit factor on OOS data, which probably wont be as good but you will see.

TBH i would try to find something on 50% of the data and store the patterns but then i would also try it again with 100% and search for a strategy similar to the one with 50% just to have the best latest values.

gl
 
@userque sure you can train on 50% of the data. You will see the profit factor on OOS data, which probably wont be as good but you will see.

TBH i would try to find something on 50% of the data and store the patterns but then i would also try it again with 100% and search for a strategy similar to the one with 50% just to have the best latest values.

gl

Ok, that's good that it can do that. I'm intrigued by your work. Nice job! I hope to explore it more this weekend.
 
dunno i think i first read about this kind of rules long time ago from Larry Williams

what kind of rules would you suggest more ?
i am always open to improve my work (today i found and fixed a bug already :D )

I don't know the right answer, of course, but some of the rule generation attempts I've tried are
relating indicators among multiple instruments,
another relating indicators among multiple instruments,
relating astronomical data for cyclic predictions, and
relating price waves.

One thing I've noticed is finding one set of rules that work well across multiple instruments is harder than finding rules that work on a single instrument. And I've generally tried creating rules specific to a single instrument. This probably led to more overfitting.
 
Last edited:
I don't know the right answer, of course, but some of the rule generation attempts I've tried are
relating indicators among multiple instruments,
another relating indicators among multiple instruments,
relating astronomical data for cyclic predictions, and
relating price waves.

One thing I've noticed is finding one set of rules that work well across multiple instruments is harder than finding rules that work on a single instrument. And I've generally tried creating rules specific to a single instrument. This probably led to more overfitting.
hm interesting

again i remember Larry Williams on this i think he also used "astronomical data" but in the end it was a month cycle and he noticed in some days of the month the stock index tends to go up (maybe it was because of people getting their salaries or something). But i guess it wont be that easy these days.
 
So i made an improvement (among other things that arent obvious) you can upload csv data from yahoo finance.

I am yet to try some individual stock data, any suggestions ? i will share my findings, perhaps apple can be first :P
 
So i made an improvement (among other things that arent obvious) you can upload csv data from yahoo finance.

I tried it with a file downloaded from yahoo finance which resulted in empty graphs:
upload_2020-8-10_21-53-33.png
 

Attachments

So i made couple more improvements on http://algostrategies.io/

First i noticed that the whole app can become unresponsive once there is a lot of data uploaded.
Sadly this fix makes old uploaded data useless so you need to upload the data again.
Also playing around i noticed it can crash when chrome decides that there is too much data uploaded.

Another change is about the stocks/data. So i did try apple and noticed quickly that the chart sucks when the data changes overtime rapidly (so from 10$ to 400$). Basically the equity on the chart goes sideways and only last fraction goes suddenly up. My fix is to have 2 charts, one is basic, second/new is adjusted so it takes percentage changes rather then changes in absolute numbers.
Lastly i also fixed the fitness function so that the profit factor is counted based on percentage changes.

sooo i think its better.

I do my research on apple again tomorrow :)
 
Back
Top