Can't use strategy

How to create strategies and indicators
Message
Author
unki
Posts: 1
Joined: Fri Nov 06, 2015 10:12 am

Can't use strategy

#1 Postby unki » Fri Nov 06, 2015 10:16 am

Hi All.

I'm trying to write simple strategy. Code is OK and building. But after I copy it to FT2/Strategy folder - I can't see my dll file in list of strategies. Can somebody help me?
My code:

Code: Select all

#include <windows.h>
#include "StrategyInterfaceUnit.h"
#include "TechnicalFunctions.h"

// external parameters
int       Type = 1;
double    Lot = 0.1;
int       SL = 20;
int       TP = 20;
// internal variables


//-----Init strategy----------------------------------------------------------
EXPORT void __stdcall InitStrategy()
{
  StrategyShortName("test");
  StrategyDescription("This strategy does something");

  RegOption("Type", ot_Integer, &Type);
  RegOption("Lot", ot_Double, &Lot);
  RegOption("SL", ot_Integer, &SL);
  RegOption("TP", ot_Integer, &TP);
}

//-----Process single tick----------------------------------------------------
EXPORT void __stdcall GetSingleTick()
{
   int OrderHandle;
   if (OrdersTotal() == 0) {
      if(Type == 1){
          SendInstantOrder(Symbol() ,op_Buy,Lot, (Ask() - SL*Point()), (Ask() + TP*Point()), "testbuy", 0, OrderHandle);
      }else{
         SendInstantOrder(Symbol() ,op_Buy,Lot, (Bid() + SL*Point()), (Bid() - TP*Point()), "testsell", 0, OrderHandle);
      }
  }
}


FX Helper
Posts: 1477
Joined: Mon Apr 01, 2013 3:55 am

Re: Can't use strategy

#2 Postby FX Helper » Mon Nov 09, 2015 9:42 am

Hello,

Please try to add .dll file via File -> Install -> Install New Strategy menu.

Do you see any error messages?


Return to “FT API”

Who is online

Users browsing this forum: No registered users and 26 guests