示例#1
0
文件: ai.c 项目: bengelbert/ifsc
int init()
{
#define WT_INFO_NAME    "info"
    ObjectCreate(WT_INFO_NAME, OBJ_LABEL, 0, 0, 0); // Creating obj.
    ObjectSet(WT_INFO_NAME, OBJPROP_CORNER, 0); // Reference corner
    ObjectSet(WT_INFO_NAME, OBJPROP_XDISTANCE, 10); // X coordinate
    ObjectSet(WT_INFO_NAME, OBJPROP_YDISTANCE, 15); // Y coordinate
    //----
    return (0);
}
SFUtils::ObjectSet SFUtils::getAllInstanceEquivalent( Udm::Object object ) {

    Udm::Object archetype = getTopArchetype( object );
    if ( archetype == Udm::null ) return ObjectSet();

    ObjectList objectList;
    objectList.push_back( archetype );
    for( ObjectList::iterator oblItr = objectList.begin() ; oblItr != objectList.end() ; (void)++oblItr ) {
        ObjectSet objectSet = oblItr->instances();
        objectList.insert( objectList.end(), objectSet.begin(), objectSet.end() );
    }
    return ObjectSet( objectList.begin(), objectList.end() );
}
SFUtils::ObjectSet SFUtils::getAllInstanceEquivalent( Udm::Object object ) {

	Udm::Object archetype = getTopArchetype( object );
	if ( archetype == Udm::null ) return ObjectSet();

	ObjectList objectList;
	/*objectList.push_back( archetype );
	for( ObjectList::iterator oblItr = objectList.begin() ; oblItr != objectList.end() ; (void)++oblItr ) {*/
		ObjectSet objectSet =archetype.instances();
		for(ObjectSet::iterator obj_it=objectSet.begin();obj_it!=objectSet.end();++obj_it)
		{
			if(isFromSameSignalFlowModel(*obj_it))
				objectList.push_back(*obj_it);
		}
//		objectList.insert( objectList.end(), objectSet.begin(), objectSet.end() );
	//}
	return ObjectSet( objectList.begin(), objectList.end() );
}
示例#4
0
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
    IndicatorBuffers(7);
//---- drawing settings
    SetIndexStyle(0,DRAW_SECTION);
//---- indicator buffers mapping
    SetIndexBuffer(0,MasterIndicator);
    SetIndexBuffer(1,SNN_Indicator);
    SetIndexBuffer(2,ZigzagBuffer);
    SetIndexBuffer(3,HighMapBuffer);
    SetIndexBuffer(4,LowMapBuffer);
    SetIndexBuffer(5,CompraE_S1);
    SetIndexBuffer(6,VentaE_S1);

    SetIndexEmptyValue(0,0.0);
    SetIndexEmptyValue(1,0.0);
    SetIndexEmptyValue(2,0.0);
    SetIndexEmptyValue(5,0.0);
    SetIndexEmptyValue(6,0.0);
//---- indicator short name
    IndicatorShortName("H5PHET - Master Trainer 2 ("+pipsTPSL+","+maxDias+","+numDias+")");
//---- initialization done
   PrimeraVez=0; // Para que se ejecute solo una vez después de la inicialización.


// agregado por H
    // new label object
    ObjectDelete("label_object2");
    if(!ObjectCreate("label_object2", OBJ_LABEL, 0, 0, 0))
    {
        Print("error: cant create label_object! code #",GetLastError());
        return(0);
    }
    ObjectSet("label_object2", OBJPROP_XDISTANCE, 250);
    ObjectSet("label_object2", OBJPROP_YDISTANCE, 0);
    ObjectSetText("label_object2", "H5PHET - Master Trainer 2", 10, "Times New Roman", Green);
    caso1=0;
    caso2=0;
    caso3_1=0;
    caso3_2=0;
    maxMinutos=maxDias*1440;
    return(0);
}
示例#5
0
//-----------------------------------------------------------------------------------------------
int start()   {

   // E Farrell 2013
   // Store these values at the start
   // because they are dynamic and
   // get changed during processing later.
   int store_bars              = Bars;
   int store_indicator_counted = IndicatorCounted();
   int store_counted_bars      = store_bars - store_indicator_counted - 1;


   // Three ways of debugging:
   // Alert(...):    display popup MessageBox
   // Comment(...):  display on left corner of MAIN chart
   // Print(...):    write to "experts log"

   if (DEBUG == 1)
   {
     // Print msg to "Experts Log"
     // i.e. not to debug file
     bar_info = "";
     bar_info = StringConcatenate(bar_info, "Store_bars: ", DoubleToStr(store_bars,0), "; ");
     bar_info = StringConcatenate(bar_info, "store_indicator_counted: ", DoubleToStr(store_indicator_counted,0), "; ");
     Print (bar_info);
   }

   // Create X-Axis line along zero value
   ObjectCreate ("X-Axis", OBJ_HLINE, 1, 0, 0);
   ObjectSet    ("X-Axis", OBJPROP_COLOR, Black);
   ObjectSet    ("X-Axis", OBJPROP_WIDTH, 2);


   // vols[]
   // Compute stochastic volatility
   calc_volatility (store_bars, store_counted_bars);


   // levy_signal[]
   // Compute Levy Index
   // of Closing Price (i.e. the signal)
   calc_alpha_signal (Close, store_counted_bars);


   // levy_vol[]
   // Compute Levy Index
   // of stochastic volatility.
   calc_alpha_volatility (vols, store_counted_bars);


   // phase_wrapped[]
   // Compute WRAPPED phase
   // of levy_signal[] and levy_vol[].
   // i.e. instantaneous phase between -PI and +PI
   calc_phase (store_counted_bars);


   // Make a copy of the "phase_wrapped" array.
   // The new copy "phase_unwrapped" will be
   // worked on by the "calc_unwrap" function.
   for (int i = store_counted_bars; i >= 0; i--)
   {
         phase_unwrapped[i] = phase_wrapped[i];
   }


   // phase_unwrapped[]
   // UNWRAP the instantaneous phase
   calc_unwrap (phase_unwrapped, store_counted_bars);


   // least_squares_line[]
   // Compute regression line for unwrapped phase
   calc_regression (phase_unwrapped, phase_lookback);


   // phase_adjusted[]
   // Create a "lower" unwrapped Phase which hugs the x-axis
   calc_phase_adjusted (phase_lookback);


   return(0);
}