Help with something simple

Section for discussions related to indicators, use of indicators, and building of trading stategies using indicators.

Moderator: admin

Help with something simple

Postby cnikitopoulos94 » Tue Dec 06, 2016 1:06 pm

Hello All,

I was hoping that I could get some help since I'm still alittle new in programming. I have run into a little predicament. My intentions is for "HaveTrades" to run through Tick, but all of my indicators to run through End of Turn. (Separate Sources)

I have two types of ExtSubscribe
Code: Select all
if executiontype== "Live" then
TickSource = ExtSubscribe(1, nil, "t1", instance.parameters.Type == "Bid", "close");
end

Source = ExtSubscribe(2, nil, instance.parameters.TF, instance.parameters.Type == "Bid", "bar");



Now this part of code below is in the ExtUpdate

Code: Select all
function ExtUpdate(id, source, period)  -- The method called every time when a new bid or ask price appears.

       now = core.host:execute("getServerTime");
   -- get only time
    now = now - math.floor(now);
    -- check whether the time is in the exit time period
            if not(now >= OpenTime
         and now <= CloseTime)
         then           
                    return ;
             end
 
 
 
    if AllowTrade then
        if not(checkReady("trades")) or not(checkReady("orders")) then
            return ;
        end
    end

   if  ExecutionType ==  "Live" and  id == 1 then
         
         period= core.findDate (Source.close, TickSource:date(period), false );      
               
   end


   if  ExecutionType ==  "Live"  then
   
           if ONE == Source:serial(period) then
         return;
         end
   
         if id == 2 then
         return;
         end      
         
         
      
   else   
         if id ~= 2 then       
         return;
         end
   end


So the problem is as such

1. If execution type is End of Turn it wont have "LIVE" for HaveTrades. So I just want the HaveTrades table to refresh at a "T1" time frame instead of waiting for period to "End Turn".

Any help would be greatly appreciated.
cnikitopoulos94
 
Posts: 47
Joined: Sat Sep 12, 2015 8:10 am

Re: Help with something simple

Postby cnikitopoulos94 » Thu Dec 15, 2016 1:43 am

Bump. AnyBody?
cnikitopoulos94
 
Posts: 47
Joined: Sat Sep 12, 2015 8:10 am

Re: Help with something simple

Postby Apprentice » Sun Dec 18, 2016 11:55 am

U can use End of Turn_Live Execution Strategy Template.lua
viewtopic.php?f=28&t=2712
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia


Return to Discussions

Who is online

Users browsing this forum: No registered users and 4 guests