Jump to content
Co nového? Mé kurzy
Komunita:
Diskuze Sledované příspěvky Žebříčky

Doporučené příspěvky

Odesláno

emun

#region Variables

double exittime = 220000; // Default setting for exit time

#endregion


protected override void OnBarUpdate()
{

if(ToTime(Time[0]) >= exittime )
{
if (Position.MarketPosition == MarketPosition.Long) ExitLong("Exit Time Long","");
if (Position.MarketPosition == MarketPosition.Short) ExitShort("Exit Time Short","");
}
}

#region Properties

[Description("")]
[Category("Parameters")]
public double Exittime
{
get { return exittime; }
set { exittime = Math.Max(1, value); }
}
#endregion

  • Odpovědí 122
  • Vytvořeno
  • Poslední

Nejaktivnější diskutující

Nejaktivnější diskutující

Publikované obrázky

Odesláno

to: PetrJansky

děkuji za bleskovou odpověď. Ale domníval jsem se, že to lze jednodušeji přes Strategy builder. Takto je to pro mě začátečníka příliš komplikované.
Každopádně ještě jednou díky.
emun

  • 2 months later...
Odesláno

WodoWary

nebo kdokoliv dalsi kdo rozjel toto:


// Condition set 1
if (CrossAbove(CCI(CCI_short), 0, 1)
&& CCI(CCI_long)[1] >= 0
&& CCI(CCI_long)[0] && CCI(CCI_long)[2] > CCI(CCI_long)[1]
&& CCI(CCI_long)[0] > CCI(CCI_long)[1]
&& Close[0] > EMA(EMA_prvni)[0]
&& Close[0] > EMA(EMA_druha)[0]
&& ToTime(Time[0]) >= ToTime(15, 30, 0)
&& ToTime(Time[0]) {
DrawArrowUp("My up arrow" + CurrentBar, false, 0, Low[0] + -10 * TickSize, Color.Lime);
DrawText("My text" + CurrentBar, "0/v", 0, Low[0] + -20 * TickSize, Color.Green);
}

// Condition set 2
if (CCI(CCI_long)[1] > 0
&& CCI(CCI_long)[1] && CCI(CCI_long)[2] > CCI(CCI_long)[1]
&& CCI(CCI_long)[0] > CCI(CCI_long)[1]
&& CCI(CCI_short)[1] > 0
&& CCI(CCI_short)[1] && CCI(CCI_short)[2] > CCI(CCI_short)[1]
&& CCI(CCI_short)[0] > CCI(CCI_short)[1]
&& Close[0] > EMA(EMA_prvni)[0]
&& Close[0] > EMA(EMA_druha)[0]
&& ToTime(Time[0]) >= ToTime(15, 30, 0)
&& ToTime(10, 11, 7) {
DrawArrowUp("My up arrow" + CurrentBar, false, 0, Low[0] + -10 * TickSize, Color.Lime);
DrawText("My text" + CurrentBar, "2v", 0, Low[0] + -30 * TickSize, Color.Green);
}



tak skladam poklounu a chtel bych se zeptat jestli by mi nemohl nahodou ten soubor cely poslat protoze me to nepojede a nepojede a to se na to divam uz delsi chvilku.....

  • 1 month later...
Odesláno

Nestudoval jsem, o cem toto vlakno je, ale ta hlaska rika:

"Prestoze mate zapnute potvrzovani prikazu, prikazy generovane strategiemi budou odeslany bez potvrzeni."

Toto neni zadna chybova hlaska, pouze informativni... ale muzes stat za zkousku to potvrzovani prikazu vypnout.

Odesláno

Zdravim,
to mi uz nevadi je 100x lepsi si udelat ze zecatku system svuj a sam ho odzkouset ale chtel bych vedet, jak zobrazim na mem (grafu volume 1000) aktualni hodonotu volume tzv treba 800 v levem hornim rohu jde to nejak?
a jeste mam posledni dotaz mam tento indikator ema cross: zdrojak :


protected override void OnBarUpdate()
{
if( CurrentBar {
setValue( data, 0, 0.0d );
//data.Add( 0.0d );
return;
}

if( ShowPlot )
XOver.Set( XOver[ 1 ] );
if( lastCalcBar != CurrentBar )
{
lastCalcBar = CurrentBar;
xOver( 1 );
}
xOver( 0 );
}
//int direction = 0;

public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
{
// Default plotting in base class.
base.Plot(graphics, bounds, min, max);

if (base.Bars == null || ShowPlot ) return;


int index = -1;
Exception caughtException;



int barPaintWidth = base.ChartControl.ChartStyle.GetBarPaintWidth(base.ChartControl.BarWidth);
int triangleWidth = 10;
int bars = base.ChartControl.BarsPainted;
while (bars >= 0)
{
index = ((base.ChartControl.LastBarPainted - base.ChartControl.BarsPainted) + 1) + bars;
if (base.ChartControl.ShowBarsRequired || ((index - base.Displacement) >= base.BarsRequired))
{
try
{
if( data.Count > index && (double)data[ index ] != 0 )
{
double val = (double)data[ index ];
int dir = 1;
if( val {
val = val * -1;
dir = -1;
}

Brush brush;
int x1 = (((base.ChartControl.CanvasRight - base.ChartControl.BarMarginLeft - barPaintWidth ) ) - ((base.ChartControl.BarsPainted - 1) * base.ChartControl.BarSpace)) + (bars * base.ChartControl.BarSpace);
int y1 = (bounds.Y + bounds.Height) - ((int) (((val - min) / ChartControl.MaxMinusMin(max, min)) * bounds.Height));
int triangleTip;
//int y2 = (bounds.Y + bounds.Height) - ((int) (((Values[2].Get(index) - min) / ChartControl.MaxMinusMin(max, min)) * bounds.Height));
if( barPaintWidth > triangleWidth )
{
x1 += ( barPaintWidth - triangleWidth ) / 2;
}
else if( barPaintWidth {
x1 -= ( triangleWidth - barPaintWidth ) / 2;
}
y1 = y1 + (int)( 0.5 * ( ( dir * -1 ) * triangleWidth ) );

if( dir > 0 )
{
brush = new SolidBrush( FallingColor );
triangleTip = y1 + triangleWidth / 2;
}
else
{
triangleTip = y1 - triangleWidth / 2;
brush = new SolidBrush( RisingColor );
}
Point[] points = new Point[]{ new Point( x1, y1), new Point( x1 + triangleWidth, y1 ), new Point( x1 + ( triangleWidth / 2 ), triangleTip ) };
graphics.FillPolygon( brush, points );
Pen pen = new Pen( Color.FromKnownColor( KnownColor.Black ) );
graphics.DrawPolygon( pen, points );
}
}
catch (Exception exception) { caughtException = exception; Print( exception.ToString() ); }

}
bars--;
}
}

private void xOver( int bar )
{
try
{
bool crossAbove = false;
bool crossBelow = false;
bool added = false;
int now = bar + 1;
int after = now - 1;
int before = now + 1;
if( !Confirmation )
{
now = bar;
before = now + 1;
if( maFast[ now ] > maSlow[ now ] && maFast[ before ] crossBelow = true;
else if( maFast[ now ] = maSlow[ before ] )
crossAbove = true;
}
else
{
if( maFast[ now ] >= maSlow[ now ] && maFast[ before ] = maSlow[ after ] )
crossBelow = true;
else if( maFast[ now ] = maSlow[ before ] && maFast[ after ] crossAbove = true;
}

double val = 0;
if( crossAbove )
{
added = true;
val = High[ now ] + ( TickSize * TriangleDisplacement );

setValue(data, now, val );
if( DrawObjects && !ShowPlot )
DrawTriangleDown( "DownArrow " + ( CurrentBar - now ), true, now, val, FallingColor );
if( ShowPlot )
XOver.Set( now, -1 );

//DrawTriangleDown(CurrentBar.ToString(), now, val, FallingColor );
}
else if( crossBelow )
{
added = true;
val = Low[ now ] - ( TickSize * TriangleDisplacement );
setValue( data, now, val * -1 );
if( DrawObjects && !ShowPlot )
DrawTriangleUp( "UpArrow " + ( CurrentBar - now ), true, now, val, RisingColor );
if( ShowPlot )
XOver.Set( now, 1 );
//DrawTriangleUp(CurrentBar.ToString(), now, val, RisingColor );
}
if( !added && bar == 0)
setValue( data, bar, 0.0d );
// data.Add( 0.0d );
//if( ShowPlot )
// XOver.Set( now, maFast[ now ] - maSlow[ now ] );
}
catch( Exception ex )
{
Print( ex.ToString() );
}
//lastDirection = direction;

}


pokazde kdyz se mi vykresli triangle (trojuhelnik) tak bych chtel aby mi tento indikator prehral zvuk. Bohuzel jse v tom nevyznam.. muze mi nekdo pomoc?

Dekuji S pozdravem Meitner.

  • 3 months later...
  • 3 týdny později...
  • 1 month later...
Odesláno

Ahoj, zkusil jsem v Ninja TRade 7 (7.0.10000.4) podle manualu 2xCCI indikatory. Vse v poradku. Ovsem pouziti strategie nefunguje. Zjednodusil jsem ji jen na to, ze CCI prejde z minus na plus skrze 0. Ovsem pokud tak nastane, tak se zadna sipka (testovani) nezobrazi. Nesetkla se nekdo z Vas s timto problemem?

Predem diky za odpoved.

Odesláno

Mám úplně stejný problém, ale i když dám Enabled, nic se neděje, opravdu nevím, co s tím, volil jsem i úplně nejjednodušší strategie, abych neměl chybu ve stavbě - se stejným výsledkem, hold to asi budu muset udělat ručně všechno :)


×
×
  • Vytvořit...